7 lines of code, 3 minutes: Implement a programming language from scratch
matt.might.net
matt.might.net
Edit: (Yes I know the difference, and I changed the he to 'you')
Lisp is handy from it's data-is-code mentality it already has a general-purpose parser built in. It's something that is fairly easy to implement for functional languages which is much harder to implement for OOP languages.
This kind of stuff also showed up in my program analysis and advanced compiler classes, too.
One of the class projects was to implement first-class macros, and we used an interpreter that looked a lot like the one from this article:
http://matt.might.net/articles/metacircular-evaluation-and-f...
(/article author)
(I also had to walk to class barefoot in the snow uphill both ways)
http://tfeb.org/lisp/hax.html#CONDUITS
Literally, a package hack with zero implementation :-)
Import defmacro and friends and you have it.
Lisp macros need knowledge of the structure of the s-expression.
Certainly one can Church encode s-expressions and provide defmacro.
Gensym is trickier. Hygiene might be really challenging.
I might actually try that out.
(/article author)
I recently rediscovered this for myself: http://arclanguage.org/item?id=11880