[antlr-interest] ANTLR3 C Target Runtime Error

Ha haiscai2003 at yahoo.com
Tue Jun 1 03:41:27 PDT 2010

I meant it works with your example but the same include files and library gives me the same crash with my grammar. 

So generated files are different. My grammar generates an AST. Yours doesn't.


On 1 Jun 2010, at 10:09, Ha <haiscai2003 at yahoo.com> wrote:


Thanks for your reply. 

I have tried one of those examples but I still get the same runtime crash
due to the fact that the state "member" variable is not initialized.

Is there a way to properly initialize it?
( as opposed to just passing it as a parameter which doesn't work).


On 28 May 2010, at 18:00, "Jim Idle" <jimi at temporal-wave.com> wrote:

Download the examples from the download page and check out the driver there, in case there is something else that is no up to date in my online docs (that I will update soon;-)


From: H S [mailto:haiscai2003 at yahoo.com] 
Sent: Friday, May 28, 2010 12:48 AM
To: Jim Idle
Subject: Re: [antlr-interest] ANTLR3 C Target Runtime Error

The code I am using is the one in the documentation found here:


I have just changed these two lines, just to make it compile:

tstream = antlr3CommonTokenStreamSourceNew(ANTLR3_SIZE_HINT, lxr->pLexer->tokSource);

if (psr->pParser->rec->errorCount > 0)

For the first one, I had added the TOKENSOURCE macro and for the second one I changed errorCount to getNumberOfSyntaxErrors.

That's really it.



From: Jim Idle <jimi at temporal-wave.com>
To: "antlr-interest at antlr.org" <antlr-interest at antlr.org>
Sent: Thu, May 27, 2010 2:52:53 PM
Subject: Re: [antlr-interest] ANTLR3 C Target Runtime Error

Correct function, but obviously you are doing something wrong because the hundreds of parsers out there already would not be there if there was a bug as fundamental as this one. Follow the C examples or post your driver code so we can see what you are doing wrong.


-----Original Message-----
From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
bounces at antlr.org] On Behalf Of H S
Sent: Thursday, May 27, 2010 2:43 AM
To: antlr-interest at antlr.org
Subject: [antlr-interest] ANTLR3 C Target Runtime Error


There seems to be a bug in the generated C sources (antlr3lexer.c): the
state variable is NULL and dues to that it crashes later.
It is NULL because LangParserNew passes NULL to LangParserNew SSD, etc.
I have tried a few versions (3.1.3, 3.2,etc ) and all seem to have this
Am I calling the wrong function (LangParserNew)?


List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address


More information about the antlr-interest mailing list