Oddly enough, I'm not a parser or grammar expert, but it's my
understanding that the parsers ANTLR generates can recover from parse
errors much more efficiently. Others on the list may be able to confirm
or refute that. However the most efficient model I've heard about is
called "parser combinators". I have no knowledge of it other than that
it combines many "mini parsers" that individually handle smaller parts
of the code, so you can cut off parsing at any point or parse
subsections of a file. To my knowlege, there's no such parser for Ruby
anywhere. ANTLR's probably your best bet for now.
Error recovery is not easy. You need to write lots of embedded actions and
things turn ugly really quick. Normally it is a good idea to be not too
picky in the parser(accept more if you can) and delay some error checking to
ast walking.
Antlr is good for error recovery (as it is the only one I am good at, your
may want to ask others for more opnions;)). The best thing of antlr is it
generates human readable result which is close to what you will write by
hand. And Terence indicates antlr v3 has much better error recovery.
Our (grammarians) grammar is actually one contributed by the XRuby
project, and by most accounts it's the most complete ANTLR grammar yet
available. Xue has managed to get XRuby to parse and compile everything
in Ruby's "test.rb", which is no small feat. I believe this grammar
could probably use an update (Xue, is this true?).
Yes I did lots of cleanup but it causes some small problems as well. I will
update the repository on this project once everything comes back together.
_________________________________________________________________
FREE online classifieds from Windows Live Expo buy and sell with people
you know
http://clk.atdmt.com/MSN/go/msnnkwex0010000001msn/direct/01/?href=http://expo.live.com?s_cid=Hotmail_tagline_12/06
_______________________________________________
Rubygrammar-grammarians mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rubygrammar-grammarians