Skip to content

threez/rlisp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This is an simple LISP-interpreter witten in ruby. 
Given a Lisp Expression like this:

  (+ (* 3 4) 2)

The Lexer will produce:

  [:+ [:* 3 4] 2]

Ruby symbols are LISP atoms and arrays are lists.

The interpreter evals the whole list and executes the apply method
on the functions.

The build-in functions are the functions that are attached to the interpreter
class. To bootstrap the interpreter the Core and Math modules (of helper.rb)
are included in the interpreter class. This makes Ruby integration rather
simple. Just include your ruby modules in the interpreter.

Using the interpreter by using the classes:

	l = Lisp::Lexer.new
	p = Lisp::Parser.new
	l.tokenize("test.lisp", p)
	i = Lisp::Interpreter.new
	i.start p.node
	
Evaluate a file:

	i = Lisp::Interpreter.new
	i.import("my_lisp_file.lisp")
	
Or just start the command line interface with REPL (read eval print loop):

  ./bin/rlisp

About

Ruby implementation of a lisp

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published