If by "lisp from scratch" you mean an s-expression interpreter that can run programs like recursive exponentiation or recursive fibonnaci, very little. You can do that in a low few hundred lines of code.
If you mean for the full power of a lisp then you still have to pick: for Scheme that might be call-with-cc and hygienic macros. For Common Lisp that might be regular macros and reader macros. Those take more code and thought.
IMO call-with-cc AND regular macros is what one should implement for toy language. Hygienic macros are too hard to understand let alone implement, while ordinary macros are more powerful (and maintainability does not matter much for toy language) and relatively easy to implement. And call-with-cc is too fun to skip.
Hygienic macros are too hard to understand let alone implement, while ordinary macros are more powerful (and maintainability does not matter much for toy language) and relatively easy to implement.
Understanding hygienic macros isn’t all that hard but I agree implementing them is difficult. On multiple occasions I’ve tried to plan out how to get them to work but (ironically) everything I can find only explains the theory and not how to practically implement them.
Comments
If by "lisp from scratch" you mean an s-expression interpreter that can run programs like recursive exponentiation or recursive fibonnaci, very little. You can do that in a low few hundred lines of code.
If you mean for the full power of a lisp then you still have to pick: for Scheme that might be call-with-cc and hygienic macros. For Common Lisp that might be regular macros and reader macros. Those take more code and thought.
IMO call-with-cc AND regular macros is what one should implement for toy language. Hygienic macros are too hard to understand let alone implement, while ordinary macros are more powerful (and maintainability does not matter much for toy language) and relatively easy to implement. And call-with-cc is too fun to skip.
Understanding hygienic macros isn’t all that hard but I agree implementing them is difficult. On multiple occasions I’ve tried to plan out how to get them to work but (ironically) everything I can find only explains the theory and not how to practically implement them.