top | item 9109225

Lisp implemented in under 1K of JavaScript

108 points| swannodette | 11 years ago |github.com | reply

16 comments

order
[+] andrewchambers|11 years ago|reply
This person wrote a lisp in 1K lines of C (not bytes :)), the cool thing is that also includes a copying garbage collector.

https://github.com/rui314/minilisp

[+] mrottenkolber|11 years ago|reply
I wrote a minimal Lisp compiler (targeting C) when I was a bit younger. :> My GC was just a really bad reference counting implementation though. I dare you to make fun of my "hash function". Hehe.

https://github.com/eugeneia/microlisp

[+] rrmm|11 years ago|reply
IMO, the garbage collection (along with optimization) is the most interesting part of implementing a lisp.
[+] PinnBrain|11 years ago|reply
So much effort to go under 1K (in the era of 128GiB fingernail chips), with this .gitignore:

node_modules -uglify -crush -regpack

[+] guard-of-terra|11 years ago|reply
Thank you for at least not writing another Brainfuck clone.
[+] mattdw|11 years ago|reply
It's JSON lists as s-exps, which means (as I understand it) that the author doesn't need to implement parsing, only traversal and evaluation. (Which can essentially be a big-ass case statement.)

    ["def", "foo", 1]
    ["fn", "foo", ["a", "b"], […]]
It's not the most attractive Lisp I've seen…
[+] infogulch|11 years ago|reply
So write a lisp parser, then dump the result into this. I like that they didn't include a parser in compacted code, such a parser wouldn't be very interesting.