tinylisp
A lisp implemented using NaN boxing and in Zig.
Examples
Arithmetic
add, sub, mul, div:
In[]:= (add 1 2 3 4)
Out[]= 10
In[]:= (div 3.4 4)
Out[]= 0.85
Structural
car, cdr, cons:
In[]:= (car '(1 2 3))
Out[]= 1
In[]:= (cons 1 2)
Out[]= (1 . 2)
Build
Compiled using zig version:
$ zig version
0.11.0
Compile the main.zig file using zig build-exe
:
$ zig build-exe src/main.zig
$ ./main
Or run it directly using zig run
:
$ zig run src/main.zig
TODO:
- [] Compile to .wasm and add a javascript REPL
- [] Expand documentation