[antlr-interest] Lexer speed comparison

Alex Sedow alexsedow at mail.ru
Sun Feb 29 02:32:02 PST 2004


It is possible add to ANTLR3 operator priority? I read in some papers that
adding operator priority to yacc-based C++ grammars speed up whole parser
speed about 20%. And of course grammar with priorities more compact and
simpler.

yacc grammar with priorities looks like this:

%left "==" "*+" "/" "%=" "+=" "-=" ">>=" "<<=" "throw" "&=" "^=" "|="
%left "?"
%left "||"
%left "&&"
...

GeneralExpression :
    : lxmIntegerLiteral
    | lxmCharacterLiteral
    | lxmFloatingLiteral
    | lxmStringLiteral
...
    | GeneralExpression ".*" GeneralExpression
    | GeneralExpression "->*" GeneralExpression
    | GeneralExpression "*" GeneralExpression
    | GeneralExpression "/" GeneralExpression
    | GeneralExpression "%" GeneralExpression
...
    ;

--
Alex.



 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
     http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
     antlr-interest-unsubscribe at yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
     http://docs.yahoo.com/info/terms/
 



More information about the antlr-interest mailing list