[antlr-interest] Faster expression parsing
Terence Parr
parrt at cs.usfca.edu
Thu Aug 28 11:07:50 PDT 2008
Heh, really cool! This is a similar approach to:
http://www.antlr.org/wiki/display/~admin/2008/03/23/Faster+expression
+parsing+for+ANTLR
except that you do the appropriate tree construction and after parsing
without consideration of operator precedence. Interesting. I wonder
which is faster.
Note that you can improve the speed slightly when you are grammar by
removing unnecessary tree stuff.
> primary_expression
> : INTEGER
> -> ^(INTEGER)
> | '(' expression ')'
> -> expression
> ;
primary_expression
: INTEGER
| '(' expression ')' -> expression
;
Let me know if that makes a difference.
Ter
More information about the antlr-interest
mailing list