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

Bruno Cadonna cadonna at inf.unibz.it
Tue Jun 23 06:52:33 PDT 2009


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
gen/sase_fubParser.h:127: warning: data definition has no type or  
storage class
gen/sase_fubParser.h:135: error: syntax error before 'CommonTree'
gen/sase_fubParser.h:135: warning: no semicolon at end of struct or  
union
gen/sase_fubParser.h:138: warning: data definition has no type or  
storage class
gen/sase_fubParser.h:146: error: syntax error before 'CommonTree'
gen/sase_fubParser.h:146: warning: no semicolon at end of struct or  
union
gen/sase_fubParser.h:149: warning: data definition has no type or  
storage class
gen/sase_fubParser.h:157: error: syntax error before 'CommonTree'
gen/sase_fubParser.h:157: warning: no semicolon at end of struct or  
union
gen/sase_fubParser.h:160: warning: data definition has no type or  
storage class
gen/sase_fubParser.h:168: error: syntax error before 'CommonTree'
gen/sase_fubParser.h:168: warning: no semicolon at end of struct or  
union
gen/sase_fubParser.h:171: warning: data definition has no type or  
storage class
gen/sase_fubParser.h:179: error: syntax error before 'CommonTree'
gen/sase_fubParser.h:179: warning: no semicolon at end of struct or  
union
gen/sase_fubParser.h:182: warning: data definition has no type or  
storage class
gen/sase_fubParser.h:190: error: syntax error before 'CommonTree'
gen/sase_fubParser.h:190: warning: no semicolon at end of struct or  
union
gen/sase_fubParser.h:193: warning: data definition has no type or  
storage class
gen/sase_fubParser.h:201: error: syntax error before 'CommonTree'
gen/sase_fubParser.h:201: warning: no semicolon at end of struct or  
union
gen/sase_fubParser.h:204: warning: data definition has no type or  
storage class
gen/sase_fubParser.h:212: error: syntax error before 'CommonTree'
gen/sase_fubParser.h:212: warning: no semicolon at end of struct or  
union
gen/sase_fubParser.h:215: warning: data definition has no type or  
storage class
gen/sase_fubParser.h:223: error: syntax error before 'CommonTree'
gen/sase_fubParser.h:223: warning: no semicolon at end of struct or  
union
gen/sase_fubParser.h:226: warning: data definition has no type or  
storage class
gen/sase_fubParser.h:234: error: syntax error before 'CommonTree'
...
...

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

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   Bruno Cadonna
     Database and Information Systems (DIS)
       Faculty of Computer Science
         Free University of Bozen-Bolzano

   Sernesistr. 1 - Via Sernesi, 1
   Block A, Room 4.15
   39100 Bozen-Bolzano
   Italy

   web: http://www.inf.unibz.it/~cadonna



More information about the antlr-interest mailing list