I was wondering if the Ruby 2 parser/compiler will be written in Ruby.
It could be possible to do so, using at the beginning Ruby 1.9 to run
it and when it is ready, it could compile itself and be run into the
Rite virtual machine. I read that the Perl 6 compiler will be written
in Perl, so why not the Ruby one ?
I was wondering if the Ruby 2 parser/compiler will be written in Ruby.
It could be possible to do so, using at the beginning Ruby 1.9 to run
it and when it is ready, it could compile itself and be run into the
Rite virtual machine. I read that the Perl 6 compiler will be written
in Perl, so why not the Ruby one ?
ByteCodeRuby [1] partially uses this approach. The parser is Ruby
1.8.1's with the internal NODEs then made available to Ruby code using
Ruth [2]. BCR's compiler is written in Ruby and compiles the NODE tree
to its own bytecode format. The bytecode is then run by BCR's bytecode
runner (written in C).
The latest CVS code for BCR moves onto the next stage: rather than
Ruby 1.8.1 running the compiler code, BCR can run it itself from saved
bytecode files. It all gets a bit circular and difficult to describe,
but it does work!