3 ms·
I had once started writing a Lisp interpreter in Python, only to realize that I was leveraging a lot of pythonic power (most notably at least for me at the time
by wfn 12y ago
I had once started writing a Lisp interpreter in Python, only to realize that I was leveraging a lot of pythonic power (most notably at least for me at the time - garbage collection) - i.e. more than I had planned to use.
So then I switched to writing the same interpreter in C, and building my own memory manager. (As is usually the case --) turns out it's more complicated (for someone with little experience in writing these sorts of things) than one might expect. :) But it's very rewarding indeed.
Of course I still think that there's much value in writing such an interpreter in Python. I would simply recommend for someone doing that to later on re-write it in some lower level language!
Re: this, Norvig commented/said,
> [...] we are relying on many features of Python: call stack, data types, garbage collection, etc. The next step would be to show a compiler to some sort of assembly language. I think either the Java JVM or the Python byte code would be good targets. We'd also need a runtime system with GC. I show the compiler in my PAIP book.
- sillysaurus3 12y agoIs your lisp interpreter's C source code available anywhere? I'd love to dig through it.
- wfn 12y agoHonestly, the code is a mess. (Really.) I'm trying to determine/recall how far I was able to get by looking at it (at least the initial goal was to have functionality akin to jmc's original paper, with syntax from pg's reinterpretation of it[1].) I'm putting "clean up [, possibly finish] and push to a repo" on my "generic todo list." :) will try to remember to ping you if/when that happens. Until then, honestly not much use of it. [1]: http://lib.store.yahoo.net/lib/paulgraham/jmc.ps http://lib.store.yahoo.net/lib/paulgraham/jmc.ps