[grammarians] Comparison to RubyFront grammar
Charles Oliver Nutter
charles.nutter at Sun.COM
Tue Oct 24 17:20:33 EDT 2006
MenTaLguY wrote:
> Yes... everyone talked briefly, then went off and wrote their own
> grammars separately. I had hoped for a more collaborative effort...
>
> Part of that's my fault, I guess, since I was holding the bag for key
> things like grammar unit tests and never followed through because I got
> too busy with other things.
>
> But, the important thing is that the grammars did get written, and in
> particular yours is quite complete.
Nick Sieger and I (well, mostly Nick) were looking at the XRuby grammar
at RubyConf. We generated a Java parser and compared it with our current
YACC (Jay) based version. It wasn't much faster, unfortunately, but it
would be much easier to work with and use for other projects. In
addition, it avoids our hand-written (ported from C) lexer, which is a
nasty bit of code. We did not do anything to confirm it was parsing
correctly, however, so that would probably be the next step.
> rubyfront is ANTLR 2, isn't it? If so, do you plan on porting it to
> ANTLR 3? If not, it might be a worthwhile exercise for the project to
> either port yours to ANTLR 3, or expand Sara's grammar using yours as a
> reference.
Nick made a few minor changes to the XRuby grammar and got it to work
with AntlrWorks, which is Antlr v3-based. I do not believe he tried to
generate a parser with v3.
>
> Either way, the original plan was to write an ANTLR 3 reference grammar,
> and then use that as a basis for a formal specification of Ruby's
> grammar. I think it's still a relevant goal.
>
> Are folks still interested?
Others do not believe there is value in JRuby pursuing a change of
grammar or parser at this time. I believe they are wrong, so I'm very
interested. Even if the resulting parser was inappropriate or too much
work to use for JRuby at runtime, it would still be useful for IDE work,
compiler work, etc.
--
Charles Oliver Nutter, JRuby Core Developer
headius at headius.com -- charles.nutter at sun.com
Blogging at headius.blogspot.com
More information about the Rubygrammar-grammarians
mailing list