[antlr-interest] Performance and LA(int)

Ric Klaren ric.klaren at gmail.com
Thu Feb 24 04:08:12 PST 2005


Paul J. Lucas wrote:
> 	In recent profiling, the ANTLR lexer method LA(int) is called a
> 	*lot*.  Why does the ANTLR-generated code repeatedly call it?
> 	Why not copy the current value into a local variable?

Tried to implement this a while ago but it was not easy to do with the 
current codegenerator should probably stil be some posts about it in the 
archive. It was probably due to not being able to get declarations for 
the temporary vars in the right places.

Also you can't have any LA() with sideeffect tricks anymore, although 
i'm not aware of anyone using such tricks.

Cheers,

Ric


More information about the antlr-interest mailing list