Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/daneelsan/tinylisp

Lisp implemented using NaN boxing
https://github.com/daneelsan/tinylisp

lisp zig

Last synced: 22 days ago
JSON representation

Lisp implemented using NaN boxing

Awesome Lists containing this project

README

        

# tinylisp

A lisp implemented using NaN boxing and in Zig.

## Examples

### Arithmetic

add, sub, mul, div:

```lisp
In[]:= (add 1 2 3 4)
Out[]= 10
```

```lisp
In[]:= (div 3.4 4)
Out[]= 0.85
```

### Structural

car, cdr, cons:
```lisp
In[]:= (car '(1 2 3))
Out[]= 1
```

```lisp
In[]:= (cons 1 2)
Out[]= (1 . 2)
```

## Build

Compiled using zig version:
```shell
$ zig version
0.11.0
```

Compile the main.zig file using `zig build-exe`:
```shell
$ zig build-exe src/main.zig

$ ./main
```

Or run it directly using `zig run`:
```shell
$ zig run src/main.zig
```

## TODO:

- [] Compile to .wasm and add a javascript REPL
- [] Expand documentation

## Resources
* [Lisp in 99 lines of C and how to write one yourself - Robert-van-Engelen](https://github.com/Robert-van-Engelen/tinylisp#lisp-in-99-lines-of-c-and-how-to-write-one-yourself)