131 karma · joined February 20, 2007
(Hmm, I must definitely try to port it to PEG.js :-)
As for Ruby, I am not sure if it is even possible to create a PEG grammar. Its lexer and parser are heavily interconnected and there is a lot of state involved. If the grammar will be created, I don't think it would be pretty.
What was your final result? Did you implement the left recursion in the way the paper describes, invented/found some other way or abandoned the whole idea?
I will probably implement support for left recursion in PEG.js - it is possible (see e.g. http://www.vpri.org/pdf/tr2007002_packrat.pdf). After that, the grammar could be rewritten to evaluate in the correct order.
(Another alternative - which works right now - is to change the parsing expressions to something like "additive ([+-] additive)*" and deal with the whole chain of operations with the same priority at once. I didn't use this in the example as I wanted it to be as simple as possible.)
The source code is available on my website: http://www.majda.cz/download/translating-ruby-to-php-cd.tar..... I didn't push it on GitHub because I didn't indend to develop the compiler further after finishing the thesis.
The code is BSD-licensed however, so if anyone wants to hack on it, he is free to go :-)
When the work was being finished, I aleready saw that the real-world usefulness of the compiler is minimal. This is why I didn't develop the compiler further after finishing the thesis.