[antlr-interest] C Target AST Debug Compile Error
William H. Schultz
whschultz at cedrus.com
Tue Mar 10 18:02:43 PDT 2009
On Mar 10, 2009, at 2:42 PM, Jim Idle wrote:
> William H. Schultz wrote:
>> Hello all! I just signed up to this list as I was unable to find any
>> mention of this issue anywhere on the internet, so I don't know if
>> it's just me.
>>
>> I'm getting the following compile errors:
>>
>> SimpleCWalker.c: In function ‘SimpleCWalker_Ctx_struct*
>> SimpleCWalkerNewSSD(ANTLR3_COMMON_TREE_NODE_STREAM_struct*,
>> ANTLR3_RECOGNIZER_SHARED_STATE_struct*)’:
>> SimpleCWalker.c:358: error: ‘struct
>> ANTLR3_COMMON_TREE_NODE_STREAM_struct’ has no member named
>> ‘tokenSource’
>> SimpleCWalker.c:358: error: ‘struct
>> ANTLR3_COMMON_TREE_NODE_STREAM_struct’ has no member named
>> ‘tokenSource’
>> SimpleCWalker.c:360: error: ‘struct ANTLR3_TREE_PARSER_struct’ has no
>> member named ‘setDebugListener’
>>
>>
>> I'm attaching my modifications to the C Target Makefile that I had to
>> do in order to get the samples to build a binary under Mac OS X.
> There are no changes you need to make to the Makefile for MAC. Perhaps
> you did not configure/build correctly?
I'm talking about the makefile in examples-v3/C/make/
Makefile.grammar. The only thing this makefile does is turn the
grammar files into C files--it doesn't compile or link anything. The
modification I made was so that it would also separately compile and
link the C files. Of course, you could run g++ by hand and pass it
the flags, but doesn't that defeat the purpose of having a makefile?
>
>> There are a couple paths hard-coded into it, so you'll have to do
>> minor tweaks to get it to work for you, but otherwise, it should be
>> generic enough to compile any of the C Target samples (I'm definitely
>> no expert on GNU Make). The above compile errors do NOT happen when
>> compiling the grammars without ANTLR's "-debug" flag, and it also
>> only
>> happens with tree grammars. I figured finding the issue in a sample
>> would seem to imply a bug... unless I'm doing something completely
>> wrong.
> Have you:
>
> a) Downloaded the latest ANTLR and C runtime?
Using the antlrworks.jar inside the ANTLRWorks version 1.2.3 app
bundle. Using libantlr3c-3.1.2.
>
> b) Downloaded the latest samples?
The tarball has a timestamp of 2/26/09 (which is after the release of
3.1.2), so unless things have changed in the last few weeks, yes.
>
> c) run ./configure in the C runtime directory taht is created when you
> untar the C runtime;
mkdir osx_debug
cd osx_debug
ln -s ../include . <-- this is because the scripts seem to
assume the library is not being built from a different directory
../configure --enable-debuginfo --enable-antlrdebug --prefix="$PWD/../
built_libs"
>
> d) Run make all after ./configure
make
It seems to do the same thing with or without "all."
>
> e) Run sudo make install
make install <--- no sudo because it's being installed in my own
home directory.
>
> d) Compiled as:
>
> gcc -o sample *.c -I. -I/usr/local/include
>
>
> (assuming that you did a make install to /usr/local
Roughly, yes. See above.
>
>
> Please check the online documentation on building the runtime and so
> on.. Take the Runtime API link from the home page.
Already done. So long as I don't pass the "-debug" flag to ANTLR when
compiling a tree grammar file, everything is fine. Doing this with
the samples requires modifying the Makefiles since they don't pass the
flag. As a result, the samples keep running and spit out results
instead of stopping and waiting for a remote debugger.
I know I'm a newb with ANTLR, so I know there's always the possibility
I missed something simple, but so far as I can tell, I haven't. I ran
into this issue writing my own AST grammar and went back to the
samples to see what I did wrong, but when compiled with remote
debugging enabled, they seem to have the same problem.
Of course, I recognize that you're the guy that wrote the C target, so
you'd definitely know better than I.
Thanks for the reply.
>
>
> Jim
>
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address
-------------------------------
Hank Schultz
Cedrus Corporation
http://www.cedrus.com/
More information about the antlr-interest
mailing list