In this project I've included a small and efficient mark-sweep method with pointer reversal as an alternative method to eliminate recursive calls. By contrast, a copying garbage collector requires double the heap memory, but has the advantage of being free of recursion (no call stack). There are different methods of garbage collection that can be used by a Lisp interpreter. This small Lisp interpreter includes a tracing garbage collector to recycle unused cons pair cells and unused atoms and strings. I've documented this project's source code extensively to explain the inner workings of the Lisp interpreter, which should make it easy to use and to modify the code. integrates with C (and C++) code by calling C (C++) functions for Lisp primitives, for example to embed a Lisp interpreter.easily customizable and extensible to add new special features.Lisp memory is a single cell array, no malloc() and free() calls.compacting garbage collector to recycle unused atoms and strings.plus an alternative non-recursive garbage collector (mark-sweep using pointer reversal).mark-sweep garbage collector to recycle unused cons pair cells.execution tracing to display Lisp evaluation steps.REPL with GNU readline for convenient Lisp input (optional).break with CTRL-C to return to the REPL (optional).exceptions and error handling with safe return to REPL after an error.proper tail recursion, including tail calls through begin, cond, if, let, let*, letrec, letrec*.Lisp with floating point, strings, proper closures, and macros.If you already did, then welcome back!Ī quick glance at this small Lisp interpreter's features: A logical continuation of the tinylisp project "Lisp in 99 lines of C and how to write one yourself." If you're interested in writing a Lisp interpreter of your own, then you may want to check out the tinylisp project first.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
December 2022
Categories |