Find file
Fetching contributors…
Cannot retrieve contributors at this time
35 lines (23 sloc) 903 Bytes
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 =
p =
l.tokenize("test.lisp", p)
i =
i.start p.node
Evaluate a file:
i =
Or just start the command line interface with REPL (read eval print loop):