[antlr-interest] Lexer speed comparison

Terence Parr parrt at cs.usfca.edu
Sun Feb 29 10:01:50 PST 2004


I've wondered about this.  We might be able to build a small precedence 
parser for expressions.  This has bothered me for 10 years and I would 
like to fix.

Terence

On Feb 29, 2004, at 2:32 AM, Alex Sedow wrote:

> 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
>
>
>
>
>





 
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