A little late to the party here, but I'll throw another tutorial that I absolutely loved, buildyourownlisp.com which guides you to building 'lispy' in C.
One question here for the more advanced compiler writers.. How do you go about writing a "pre-lexer" for LISP like language where you want to expand sexpr? I.e. Does the lexer even see `(...), or does it get pre-extracted to (quote ..)? And if so, how does the pre-extraction work exactly? Is it built using regex..? That can be tricky.
Lisp dialects usually have an input mechanism called a "reader". It scans the character syntax and produces the equivalent object, combining lexical analysis and parsing. Special notations like 'x denoting the same thing (quote x) are easily handled here. When the reader sees a quote, it consumes it, calls itself recursively to scan the expression which follows to get an object O and then returns the object (quote O).
Comments (75) 20 threads
Earlier commentshttp://beautifulracket.com
However my one tiny complaint is that the sign-up box is on every page, and even after I've signed up, it still has to be closed every page I go to.
I'll try to resurrect that for this one.
https://github.com/munificent/craftinginterpreters/issues/11
All comments shown.
Couldn't load more comments. Check your connection and try again.