[antlr-interest] C target: problems with setCharStream

Marc klists at saphor.de
Fri Jun 8 11:01:28 PDT 2007


Hello!

Using the C target (libantlr3c-3.0.0-rc8), antlr 3.0 and the SimpleCalc
grammar from
http://www.antlr.org/wiki/display/ANTLR3/Five+minute+introduction+to+ANTLR+3
I keep getting a core dump both under Mac OS X (PPC) and Debian Linux
(Intel):

This is the dump on gdb under Mac OS X, the one under Linux is according:

-------
Starting program: calc 1+1

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_PROTECTION_FAILURE at address: 0x0000000e
0x0001cf04 in setCharStream ()
--------

On both systems I have compiled the program with:

gcc -I IncludePath -I. simplecalcLexer.c simplecalcParser.c -LLibPath
-lantlr3c -o calc

(having renamed the grammar from SimpleCalc to simplecalc)

Compiling the program with gcc 4.0 (Mac) and 4.1.2 (Linux) gives me the
following warnings:

simplecalcLexer.c:190: warning: 'mPLUS' declared inline after being called
simplecalcLexer.c:190: warning: previous declaration of 'mPLUS' was here
simplecalcLexer.c:191: warning: 'mMINUS' declared inline after being called
simplecalcLexer.c:191: warning: previous declaration of 'mMINUS' was here
simplecalcLexer.c:192: warning: 'mMULT' declared inline after being called
simplecalcLexer.c:192: warning: previous declaration of 'mMULT' was here
simplecalcLexer.c:193: warning: 'mDIV' declared inline after being called
simplecalcLexer.c:193: warning: previous declaration of 'mDIV' was here
simplecalcLexer.c:194: warning: 'mNUMBER' declared inline after being called
simplecalcLexer.c:194: warning: previous declaration of 'mNUMBER' was here
simplecalcLexer.c:195: warning: 'mWHITESPACE' declared inline after
being called
simplecalcLexer.c:195: warning: previous declaration of 'mWHITESPACE'
was here
simplecalcLexer.c:196: warning: 'mDIGIT' declared inline after being called
simplecalcLexer.c:196: warning: previous declaration of 'mDIGIT' was here
simplecalcParser.c: In function 'main':
simplecalcParser.c:290: warning: pointer targets in passing argument 1
of 'antlr3AsciiFileStreamNew' differ in signedness

(the last two warnings only under Mac)

Any ideas? Thanks in advance for any tips!

Best regards,

Marc







More information about the antlr-interest mailing list