Re:Lisp implemented in under 1K of JavaScript
by mrottenkolber on Thursday February 26, 2015 @06:52AM
(#9112099)
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.
Re:Lisp implemented in under 1K of JavaScript
by mattdw on Wednesday February 25, 2015 @06:12PM
(#9110421)
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.)
Re:Lisp implemented in under 1K of JavaScript
by infogulch on Wednesday February 25, 2015 @06:20PM
(#9110445)
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.
Re:Lisp implemented in under 1K of JavaScript
by infogulch on Wednesday February 25, 2015 @07:12PM
(#9110634)
Yes, uninteresting, as I said. Lisp syntax is quite simple, so I would not expect it to be very difficult to make a regex to parse it. Btw, does that handle quoted strings, strings with syntax characters in them, and strings with escapes?
Re:Lisp implemented in under 1K of JavaScript
by gps408 on Thursday February 26, 2015 @12:03PM
(#9113570)
Thanks for responding, man. That's my point though. There is no cons building block in this lisp. I don't think (1 2 . 3) can be represented in it so having the notation for it makes no sense.
https://github.com/rui314/minilisp
https://github.com/eugeneia/microlisp
I'll just say this, back in the prehistoric 1970s, a '%' operation was eschewed, because it wasn't fast (relatively speaking)!!!
It often was used anyway, because it's very effective considering its simplicity.
node_modules -uglify -crush -regpack