I'm using ANTLR 3.1 and ANTLRWorks to generate a parser class in Java. The parser performs better if I mark the generated class with the Java final keyword. The problem is: I am adding this keyword manually after each time I re-generated the code from the ANTLR grammar. Is there anyway, in the grammar, of telling ANTLR to add the final keyword to the generated parser class definition?
+1
A:
What version of Java are you using? The more recent ones should detect leaf classes automatically, as should any since 1.3 in -server mode.
Pete Kirkham
2009-03-24 13:58:49
I'm using 1.6 in -server mode. Even so, omitting the final keyword does seem to add ~30% to the timings.
2009-03-24 14:04:11
A:
From this thread (oops- my bad), it looks like it's not possible to do it yet. :(