From: Robert Feldt Date: 2004-02-21T22:51:13+09:00 Subject: Re: Ruby to Parrot compiler (where is Ruth?) Mark wrote: > Thanks, that link works. Though the file linked there is misnamed. It > has the extension .tar.gz even though it's just a tar file. > > It seems that the choice for a front end is between Ripper and Ruth. > Both'll need a bit of development before they can be used, and neither > is documented. > > Personally I think Ruth is the better choice since it has fewer > dependencies (Ripper needs bison and gperf) and it's interface seems > to be simpler. > > Though it has the problem that when parsing a method definition using > the standard parse method there's no way to find out what parameters > the methods takes. However I think there might be lower level methods > which can be used in this case. > > > ISTM the best bet would be to design the compiler so that the parser > can be swapped easily. Looking at the archives for Cardinal I noticed > there was talk of Rite having a seperate parser component. Being able > to use that as a parser would be very useful. > > > I'm going to set up a project on Rubyforge in order to work on this. > On Ruby parsers I might also mention that the new version of Rockit (that I've used internally in my research for some time) has a Ruby parser. Rockit's new model is to automatically generate an AST-builder class that builds an AST for you when parsing. If you want your own callbacks without building the AST you can just subclass or write your own builder class and initialize the parser class with that. It seems to be a fairly good compromise between the different parsing "styles". I have planned to release it for long but it has some non-open code that I need to get rid of. I've sat dates before so I won't do that again though so you might be better off with something else for now... ;) Anyway, the idea is that both Ruth and Rockit's Ruby parser should generate the same AST so that they can be tested against each other for conformance. /Robert