I'd like to learn more about compilers and virtual machines, with the
eventual goal of maybe hacking on Rubinius. But I'm a bit lost trying
to sift through the available literature.
Currently I'm aware of the following books that look promising:
The Purple Dragon Book [1]
Compiler Construction: Principles and Practice (Louden) [2]
Introduction to Compiler Construction (Parsons) [3]
of some with mixed reviews:
Virtual Machine Design and Implementation in C/C++ [4]
Game Scripting Mastery [5]
and of one I can find very little about at all:
Virtual Machines: Versatile Platforms for Systems and Processes
(Smith, Nair) [6]
Right now I'm spinning a bit, and it's not clear where I should
start. I'd like to grasp some of the theory and work through some
simple cases before I look at anything complex. Can anyone recommend
any books or online resources that will get me up to speed?
Thanks
Ashley
[1] http://www.amazon.com/gp/product/0321486811/
[2] http://www.amazon.com/Compiler-Construction-Principles-Kenneth-Louden/dp/0534939724/
[3] http://www.amazon.com/Introduction-Compiler-Construction-Thomas-Parsons/dp/0716782618/
[4] http://www.amazon.co.uk/Virtual-Machine-Design-Implementation-C/dp/1556229038/
[5] http://www.amazon.co.uk/Scripting-Mastery-Premier-Press-Development/dp/1931841578/
[6] http://www.amazon.co.uk/Virtual-Machines-Versatile-Platforms-Architecture/dp/1558609105/
[7] http://www.hokstad.com/writing-a-compiler-in-ruby-bottom-up-step-1.html
> I'd recommend starting with [6] unless you're super interested in
> compilers, in which case [1] is an excellent resource. You might also
> check out http://compilers.iecc.com/crenshaw/.
Thanks Brian
Hope this discussion isn't too off-topic for the list. I'd love to
hack at Rubinius but unfortunately it's really hard to get a handle on
learning how. There's no obvious starting point as there is with,
say, learning to build a Rails app. In fact I'd compare it to
learning how to *deploy* a Rails app ( yes I've got the book now :) )
I'll definitely work through Crenshaw's tutorial, thanks for the
link. I also just stumble across a guide on Implementing a Scripting
Engine[1]
I've heard that the Dragon Book is very heavy on parsing at the
expense detail on of runtime environments.
I will look at Smith & Nair's Virtual Machine book. I noticed on
Amazon that one of the "other people bought" links is Virtual Machines
(Iain D Craig)[2] and looking at the table of contents[3] it sounds
like a good tutorial book. (Murderously expensive for its size though).
How about this as a strategy:
* Crenshaw's tutorial
* Implementing a Scripting Engine[1]
* Virtual Machines[2]
* Virtual Machine Architectures (Smith & Nair)
* then the Dragon Book (or something else compiler-specific)
Seem reasonable?
Cheers
Ashley
[1] http://www.flipcode.com/archives/Implementing_A_Scripting_Engine-Part_1_Overview.shtml
[2] http://www.amazon.co.uk/gp/product/1852339691/
[3] http://www.springer.com/computer/programming/book/978-1-85233-969-2?detailsPage=toc
> I will look at Smith & Nair's Virtual Machine book.
I've not finished it yet, but it is good so far.
> I noticed on
> Amazon that one of the "other people bought" links is Virtual Machines
> (Iain D Craig)[2] and looking at the table of contents[3] it sounds
> like a good tutorial book. (Murderously expensive for its size
> though).
Anything Springer Verlag is murderously heavy in greek symbols as
well. I generally avoid the books.
> How about this as a strategy:
> * Crenshaw's tutorial
> * Implementing a Scripting Engine[1]
> * Virtual Machines[2]
> * Virtual Machine Architectures (Smith & Nair)
> * then the Dragon Book (or something else compiler-specific)
For parsing, I really dislike things like Dragon and prefer things
like Wirth's Compiler book. It is thin, and dismissive of complexity.
I'm biased tho.
> For parsing, I really dislike things like Dragon and prefer things
> like Wirth's Compiler book. It is thin, and dismissive of complexity.
> I'm biased tho.
And it's also available for download from:
http://www-old.oberon.ethz.ch/WirthPubl/CBEAll.pdf
Andrei
There are quite a few good resources on line as well. For openers,
there's "Structure and Interpetation of Computer Programs" at
http://mitpress.mit.edu/sicp/. That's more oriented towards Scheme than
more complicated languages, but there's enough "Scheme-like" semantics
in Ruby to make it worthwhile.
The Parrot team has a lot of stuff (http://www.parrotcode.org/). And if
you don't mind a bias towards Forth, Anton Ertl and David Gregg have
published numerous papers on designing efficient interpreters. A good
place to start is
http://www.complang.tuwien.ac.at/forth/threaded-code.html. And of
course, there's "Lambda The Ultimate" at http://lambda-the-ultimate.org/.
Probably the best way to learn this stuff is to pick a simple language
(Scheme and Forth are probably the two simplest "useful" languages) and
build your own.
--
M. Edward (Ed) Borasky
http://ruby-perspectives.blogspot.com/
"A mathematician is a machine for turning coffee into theorems." --
Alfréd Rényi via Paul Erdős
http://www.swiss.ai.mit.edu/classes/6.001/abelson-sussman-lectures/
-Jeff
> I second that. Learning about lisp and scheme systems is a cool way
> to
> learn about both interpreter/compilers and the roots of many language
> concepts you find in Ruby and every other language. This series of
> videos by Abelson and Sussman is a pretty casual way to soak it up,
> and
> they are very good at teaching the concepts:
>
> http://www.swiss.ai.mit.edu/classes/6.001/abelson-sussman-lectures/
Thanks for the pointers everyone. This is all fantastic stuff I could
never have put together on my own.
As it happens I've seen two tutorials about building interpreters in
Haskell (which I've been learning recently). One for Lisp[1] and one
for Scheme[2]. They are short, so if understanding either of those
languages will be beneficial they will be worth doing first.
I've made my own dead tree version of Wirth's book, which looks MUCH
more up my street than the Dragon Book. From a quick scan through it
appears to cover all the topics I want to learn about with about equal
emphasis on each. It will probably usurp Crenshaw's tutorials as my
first extended walkthrough.
Hopefully when I've worked my way through all this (and built a few
interpreters/compilers/VMs) I be able to put a blog post together with
pointers on how to get started, for anyone else in my position.
Cheers
Ashley
[1] http://www.defmacro.org/ramblings/lisp-in-haskell.html
[2] http://halogen.note.amherst.edu/~jdtang/scheme_in_48/tutorial/overview.html