Hi Folks,
On page 47 of the ANLTR book it describes how to create a language recognizer; that is, how to avoid the overhead of building a parse tree. Here is the key to creating a language recognizer:
parser.setBuildParseTree(false); // don't waste time building a tree
So I created a grammar and fed it a large input string. I created just a language recognizer, using the above line of code (i.e., I didn't build a parse tree). I recorded the time that it took to process the input. Then I did the same thing, but this time I built the parse tree. I again recorded the time. The times were the same! That is, the time needed to simply recognize the input is the same as the time needed to create a parse tree.
I am surprised.
The ANTRL book seems to say that language recognition will be significantly faster than building a parse tree.
Would someone explain why I am getting no performance improvement with language recognition please?
Thanks!
/Roger