[antlr-interest] ANTLR3 C Target Runtime Error

Ha haiscai2003 at yahoo.com
Tue Jun 1 02:09:32 PDT 2010


Hi,

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).

Thanks!


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;-)

 

Jim

 

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:

http://www.antlr.org/api/C/index.html

 

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.

 

Thanks,

Hai

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.

Jim

> -----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
> 
> Hi,
> 
> 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
> problem.
> Am I calling the wrong function (LangParserNew)?
> 
> Thanks.
> Hai
> 
> 
> 
> 
> 
> 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