[antlr-interest] Performance and LA(int)

Paul J. Lucas pauljlucas at mac.com
Wed Feb 23 16:01:24 PST 2005


On Thu, 24 Feb 2005, Micheal J wrote:

> For C# code generation, LA(1) and LA(2) are cached in *lexers*. This
> resulted in noticeably better performance. Our basic performance tests
> suggested that caching LA1/LA2 in parsers (in addition to lexer caching)
> didn't always result in better performance. Depends on the grammar it seems.

	OK, well, I don't really care *where* they're cached, just so
	long as performance improves.

	Thought: could I override LA(int) in my own lexer and implement
	caching?  When/how would I know to invalidate the cache?  By
	also overriding consume()?

	- Paul

	P.S.: I'm using the Java API.



More information about the antlr-interest mailing list