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

Jim Idle jimi at temporal-wave.com
Fri Nov 2 06:22:13 PDT 2012


Read the docs about the other @ sections so you can include in the
correct place. But better to export your c++ fun a as c linkage and
just call functions from the actions.

Jim

On Nov 2, 2012, at 20:30, lin q <linq936 at gmail.com> wrote:

> Hi,
>
> I am using the C target and like to use C++ standard library, so I add the
> includes section:
>
> grammar tryit;
>
> options
> {
>     language = 'C';
> }
>
> @parser::includes
> {
>   #include <vector>
> }
>
>
> But this causes antlr compile error:
> error(100): busif.g:13:1: syntax error: antlr:
> org.antlr.runtime.EarlyExitException
> error(150):  grammar file tryit.g has no rules
> error(100): busif.g:0:1: syntax error: assign.types:
> org.antlr.runtime.EarlyExitException
> 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!
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address


More information about the antlr-interest mailing list