-
Notifications
You must be signed in to change notification settings - Fork 2
A Lisp designed to integrate with Lua.
baguette/lemma
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Lemma is a Lisp dialect inspired by several other languages, the most obvious ones being Scheme, Arc, and Clojure. Lemma is also highly experimental and in a constant state of change. Lemma is currently a work in progress and as such is incomplete and inefficient. The idea is to create a modern version of Lisp that integrates with the Lua virtual machine. Currently, there is a prototype interpreter that compiles to Lua and executes it on the fly. It supports most of the things that are expected in a Lisp while offering nearly seamless integration with Lua. Lua functions and tables can be used in Lemma code, and vice-versa. To reiterate: Lemma the language as well as lemma the interpreter are works in progress. The language is experimental while the interpreter provides a playground for the experimentation. The interpreter is rather slow, as it does no optimizations. It works by compiling the input into Lua, loading it into the Lua interpreter, and immediately executing it. There is only limited support for batch compilation at this time (most things work, but macros don't work properly during batch compile). It is, however, self-hosting. Any file with the .lma extension in this repository is a Lemma source file. There are quite a few located in the example/ directory, the compiler in lib/compile.lma, plus some macros in lib/std.lma. Have a look if you're curious. To use the interpreter, you need to have Lua installed (https://lua.org/). It was developed primarily with version 5.1 in mind, but should work with newer versions and with LuaJIT. If it does not, that is considered a bug. First, cd to the directory containing the Lemma source files. Make sure the lemma script is executable: $ chmod +x lemma Then execute it: $ ./lemma # start a REPL $ ./lemma file.lma # evaluate the contents of file.lma To be able to execute from other directories, some environment variables need to be set. This depends on where lemma resides on your file system, but it will typically be something along these lines: LEMMA_PATH=$HOME/Workspace/lemma PATH=$PATH:$LEMMA_PATH LUA_PATH="$LEMMA_PATH/?.lua;$LEMMA_PATH/?/?.lua;./?.lua;;" export LEMMA_PATH PATH LUA_PATH It is also recommended to install rlwrap and add a bash alias: alias lemma='rlwrap -q "\"" lemma' That's all for now...
About
A Lisp designed to integrate with Lua.
Resources
Stars
Watchers
Forks
Packages 0
No packages published