[antlr-interest] Problems with the C version of ANTLR

Andreas Volz lists at brachttal.net
Tue Sep 8 15:00:41 PDT 2009


Am Sun, 6 Sep 2009 09:40:44 +0200 schrieb Andreas Volz:

> Then I installed ANTLR-3.0.1 (Ubuntu) from repository and the C
> runtime from ANTLR-3.0.1 from source. This should fit together.

After get it working with a C compiler I tried a C++ compiler, but
failed:

In file included from /usr/include/antlr3tokenstream.h:14,
                 from /usr/include/antlr3baserecognizer.h:11,
                 from /usr/include/antlr3cyclicdfa.h:9,
                 from /usr/include/antlr3.h:11,
                 from VCardLexer.h:47,
                 from VCard.h:21,
                 from VCard.c:14:
/usr/include/antlr3bitset.h:51: error: expected unqualified-id before
'||' token /usr/include/antlr3bitset.h:51: error: expected `)' before
'||' token /usr/include/antlr3bitset.h:51: error: expected ';' before
'||' token VCard.c: In function 'int main(int, char**)':
VCard.c:94: warning: unused variable 'nodes'
make: *** [VCard.o] Error 1

I tried:

#ifdef __cplusplus
extern "C"
{
#endif

#include "VCard.h"

#ifdef __cplusplus
}
#endif

without success. Then I found this:

http://www.antlr.org/wiki/display/ANTLR3/Code+Generation+Targets

"C target as of release 3.1 is C++ compatible, compile .c files as C+.
C+ classes will be provided as a separate library later in 2008. "

Could the error message be a problem that 3.0.1 is not yet C++
compatible?

BTW: What is the current status of the C++ target/facade?

regards
	Andreas


More information about the antlr-interest mailing list