[antlr-interest] faster expression parsing
Austin Hastings
Austin_Hastings at Yahoo.com
Mon Mar 17 21:10:38 PDT 2008
Terence Parr wrote:
> So, I should have been working on something else but got to thinking
> about how annoying it is specifying expressions in recursive descent
> parsers. You have to have a new rule for each precedence level. This
> is also very slow. Just to match 34 it has to descend about 15 method
> calls.
I totally agree. (See thread at:
http://www.antlr.org/pipermail/antlr-interest/2007-December/025112.html)
> I built a prototype single-rule (plus primary and suffix) operator
> matching thingie today. I should be able to generate this from some
> metameta syntax in antlr. Try it out...it's amazing (v3.1 required
> due to tree bulding bug fix).
Closer. I want the syntax built in to Antlr. Make expression
sub-grammars some kind of callable thing.
string_expr:
@expression_subgrammar { operators = '+', '.', 'x', 'trim'(),
'ltrim'(), 'rtrim'() ; }
;
=Austin
More information about the antlr-interest
mailing list