Skip to content

CaspianA1/RasmLISP

Repository files navigation

RasmLISP Logo

RasmLISP is a Lisp compiler for x86_64 on macOS.

There is exhaustive documentation for the standard library in DOCUMENTATION.md.

Any questions are welcome at rasmlisp@gmail.com.

Here is how to try out RasmLISP (when using the build system that provides easy linking with the standard library):

  • Install dependencies via make install. (If you want to change the GC version or its installation directory, just edit install_boehm.sh as needed. Make sure to update the Makefile to change the macro BOEHM_DIR as well.)
  • Type make into your terminal. That will use the test.lisp file in the tests directory.
  • The Lisp runtime library is compiled properly.
  • The compiler is run in debug mode, meaning that the input file (the first argument to it) will be in tests. It can also be run in extern mode (the second flag) to avoid an entry point (_main).
  • parser.py tokenizes and parses the code. Each S-expression is fed into the main function eval_lisp in compiler.py. You can take a peek at that if you want to see how it works.
  • Once compilation is done the output file is tests/test.asm. The assembler configured in the Makefile will generate a binary, properly linked with the library, in out.
  • To run your output file just type make run.

If you want to try out a pre-written program, I have a demo of Conway's Game of Life in the tests directory. It uses the curses library (you can read more about the curses bindings in DOCUMENTATION.md). Simply copy its contents into tests/test.asm, and follow the steps above to run the code.