4 ms·
MRI is the first language interpreter that I got deeply familiar with and it's a pleasure to read. It was really nice to be able to find the answer to question
by haberman 14y ago
MRI is the first language interpreter that I got deeply familiar with and it's a pleasure to read. It was really nice to be able to find the answer to questions like "how does Ruby decide when to trigger a thread switch" by spending just a few minutes going to the source.
- pat_shaughnessy 14y agoAbsolutely - it is a pleasure to read. Someday I'd like to learn how another language is implemented, maybe JavaScript or something like Haskell, but I'm afraid the language source code will be much more difficult to understand than Ruby's is.
- dysoco 14y agoYou can maybe start with a Scheme parser, it's quite simple.
- pat_shaughnessy 14y agoInteresting idea - thanks for the suggestion!
- pimeys 14y agoSICP - chapter 4. http://mitpress.mit.edu/sicp/full-text/book/book-Z-H-25.html#%_chap_4 http://mitpress.mit.edu/sicp/full-text/book/book-Z-H-25.html... One of the best chapters in any book I've ever read. So mindblowing. Or if you prefer the video form, here: http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-001-structure-and-interpretation-of-computer-programs-spring-2005/video-lectures/7a-metacircular-evaluator-part-1/ http://ocw.mit.edu/courses/electrical-engineering-and-comput... http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-001-structure-and-interpretation-of-computer-programs-spring-2005/video-lectures/7b-metacircular-evaluator-part-2/ http://ocw.mit.edu/courses/electrical-engineering-and-comput...
- pat_shaughnessy 14y agoYup, (re)reading SICP is definitely on my list!
- 1337p337 14y agoOnce you can read some C, I'd recommend reading over another bytecode interpreter, like mawk (Mike's AWK): http://invisible-island.net/mawk/ http://invisible-island.net/mawk/ . Another good read is the TinyCC compiler (originally by Fabrice Bellard, who did QEMU among other things): http://savannah.nongnu.org/projects/tinycc http://savannah.nongnu.org/projects/tinycc . It's a small, mostly readable, fully functional C compiler.
- pat_shaughnessy 14y agoAwesome links - thank you!
- gtani 14y agoGHC (haskell compiler) is very well documented: http://www.haskell.org/haskellwiki/Research_papers/Compilation http://www.haskell.org/haskellwiki/Research_papers/Compilati... http://www.scs.stanford.edu/11au-cs240h/notes/ghc-slides.html#%287%29 http://www.scs.stanford.edu/11au-cs240h/notes/ghc-slides.htm... http://www.aosabook.org/en/ghc.html http://www.aosabook.org/en/ghc.html appendix: http://www.doc.ic.ac.uk/~amc4/Papers/thesis.pdf http://www.doc.ic.ac.uk/~amc4/Papers/thesis.pdf