[antlr-interest] Unable to find generated parser: "cannot find symbol"

Martin Fowler fowler at acm.org
Tue Apr 3 13:38:45 PDT 2007


Actually this isn't a question, since I found the source of my stupidity 
myself. I just I'd post it here so that Google might help out some other 
poor sap who blunders around as much as I do.

I wrote a grammar and generated the resulting parser file with 
everything fine. I then tried to use the parser from Java. IntelliJ 
would give me the pop up for the generated class, but once I accepted it 
, the new text went red. Compilation failed with the message "cannot 
find symbol" and the name of my generated class. I tried javac, thinking 
it might be an intellij problem, still wouldn't compile. I did a clean 
gen and compile with ant - still couldn't find the symbol. I checked the 
generated file and it had generated the source file in the correct 
place. Other generated items in the same location worked just fine.

For those who haven't got it yet - I forgot to put the package 
declaration in the header of the grammar file.

(Of course javac could have said something more helpful....)
-- 
Martin Fowler
http://martinfowler.com


More information about the antlr-interest mailing list