[antlr-interest] [ANTLR C Target] error: syntax error before 'CommonTree'

William H. Schultz whschultz at cedrus.com
Wed Jun 24 10:53:30 PDT 2009


For a C target, you should use this setting:

	ASTLabelType=pANTLR3_BASE_TREE;

The one you are using is specific to the Java target.


On Jun 23, 2009, at 6:52 AM, Bruno Cadonna wrote:

> Hi list,
>
> I use ANTLRWorks 1.2.3 with ANTLR 3.1.2 to generate a parser for a
> small grammar in C.
>
> The option section of my grammar is:
>
> options {
> 	language = C;
> 	output = AST;
> 	ASTLabelType = CommonTree;
> }
>
> When I want to compile the generated parser source against the C
> runtime libraries (libantlr3c-3.1.2.tar.gz), I get the following
> errors and warnings:
>
> In file included from gen/sase_fubParser.c:45:
> gen/sase_fubParser.h:124: error: syntax error before 'CommonTree'
> gen/sase_fubParser.h:124: warning: no semicolon at end of struct or
> union
>
...
> ...
> ...
>
> I use autotools (autoconf, automake, libtool) to compile the project.
> It is the first time I use them and I am not a C expert, so it could
> easily be that the problem is not related to ANTLR. But since it seems
> that there is a syntax error in the files generated by ANTLR I thought
> maybe it is a bug.
>
> Could anybody exclude or confirm that?
>
>
> Cheers,
> Bruno
>

-------------------------------
Hank Schultz
Cedrus Corporation
http://www.cedrus.com/




More information about the antlr-interest mailing list