I’ve been recently working my way through Programming Language Pragmatics 3rd ed to learn more about how languages work underneath, and I’ve gotten a lot of mileage out of looking at the assembly produced by really basic GCC-compiled C code. I’m starting to get more comfortable with static languages from the C family, and I would like to begin looking into interpreted languages as well.
Ruby, being my favorite scripting language, would be an excellent candidate for this. I think it’d be OK to start with MRI for learning purposes, and figure out how exactly all of the scanning/parsing/semantic analysis/binding/scoping and other magic happens behind the scenes.
Is this described in detail anywhere, or is there any way for me to dig into it, like say, with the disassembly of a compiled program? I haven’t done much digging with interpreted languages, so I wouldn’t quite know where to start as far as MRI is concerned.
Thanks!
Ruby itself is written in C, so it might be worth taking a look at the code. https://github.com/ruby/ruby
I also recommend Patrick Farley’s article about method dispatch. http://www.klankboomklang.com/2007/09/14/method-dispatch/