[antlr-interest] ANTLR3C - includes section causes syntax error

lin q linq936 at gmail.com
Fri Nov 2 05:30:01 PDT 2012


I am using the C target and like to use C++ standard library, so I add the
includes section:

grammar tryit;

     language = 'C';

   #include <vector>

But this causes antlr compile error:
error(100): busif.g:13:1: syntax error: antlr:
error(150):  grammar file tryit.g has no rules
error(100): busif.g:0:1: syntax error: assign.types:
org\antlr\grammar\v3\DefineGrammarItemsWalker.g: node from line 96:28
required (...)+ loop did not match anything at input ';'

If I remove the includes section, the compile is good.

Do you see what is wrong about this includes section?

Another question - my target application is in C++, as far as I can see, I
can just use the C target,  write C++ program and use g++ to compile the
generated files. I do not plan to use C++ features like exception in
parsing side. Is my assumption good?

Any pointer of example C++ usage of antlr3c is greatly appreciated!

More information about the antlr-interest mailing list