by bsder · 11y ago · 0 comments
This is a LIE.
I get tired of hearing this over and over. Broken Lisps are easy to implement.
Try implementing a real s-expression parser in C. I'll wait.
For example, this library: http://sexpr.sourceforge.net/ takes 5000+ lines of code. And it doesn't even handle dotted pairs! (For good reason, handling dotted pairs without recursion is extremely difficult.)
I have written entire languages in that number of lines. So, have many others.
Lisp does not count as small.
At just a glance, it appears that the library is slurping the expression and avoiding recursion instead optimizing for speed, memory usage, and error reporting, but it seems like you could implement a recursive descent parser if you weren't as concerned with those. If the author took their same approach to parsing s-exprs for a grammar like C, I'm not sure how successful they would be.
I haven't really looked at grammars / compilers in a long time, but I'm curious if I'm off-base in thinking s-exprs are relatively easy to parse. Some grammars like brainfuck or assembly would obviously be easier.
Really? Try it in C.
The Scheme interpreters do very limited dotted-pair parsing until they bootstrap into scheme. There is a good reason for this.
And this is before we even start dealing with things like circular references.