[antlr-interest] A bug in C Target Composite grammar

Gokulakannan Somasundaram gokul007 at gmail.com
Mon Jul 25 06:50:31 PDT 2011


Hi Jim,
        I made an upgrade to ANTLR 3.4 and tested my grammar. I am facing
the same error. I really forgot the logic behind the fix, that i have
mentioned above, but after applying the same, it started working fine. Just
wanted to inform you on that.
       In Build.txt, the command mentioned for building Uber jar is
mentioned incorrectly and it is not working fine. But in the pom.xml, it is
mentioned correctly. Please do update the Build.txt also with the same.
"mvn -Duber -DskipTests package assembly:assembly"

Please let me know, if i have done things in the wrong way.

Thanks,
Gokul.


On Tue, Feb 2, 2010 at 2:17 AM, Jim Idle <jimi at temporal-wave.com> wrote:

>  OK – that’s good enough – I can reproduce from there. I guess I wasn’t
> thinking about people importing within imports ;-) I usually just have a
> master grammar that imports everything else.****
>
> ** **
>
> Jim****
>
> ** **
>
> *From:* Gokulakannan Somasundaram [mailto:gokul007 at gmail.com]
> *Sent:* Monday, February 01, 2010 9:48 AM
> *To:* Jim Idle
> *Cc:* antlr-interest at antlr.org
> *Subject:* Re: [antlr-interest] A bug in C Target Composite grammar****
>
> ** **
>
> OK, i will try to explain, as i am restricted not to share my source.
>
> Assume the hierarchy is A->B->C->D->E
>
> Now E holds a pointer to A, B, C and D. D holds  a pointer to A, B and C
> and so on.
>
> Now the creation of A happens inside B and creation of B happens inside C
> and so on
>
> Now when creation of B happens, only the pointer of B inside C gets
> updated. But there are pointers to B from inside D and E also. They are not
> getting updated. Now a function call happens through null pointer, the
> runtime crashes. So my code just assigns the pointer to other structures
> which are above the hierarchy of the structure, which created the
> sub-parser.
>
> Please let me know, if i am unclear in my explanation.
>
> Thanks,
> Gokul.
> **
> ******
>
> On Mon, Feb 1, 2010 at 9:54 PM, Jim Idle <jimi at temporal-wave.com> wrote:**
> **
>
> Can you give me an example of what you were fixing? I do not have any
> compilation or runtime bugs that I know of. That does not mean they are not
> there but I need something to test as there are no highlights in this email
>
> Jim****
>
>
> > -----Original Message-----
> > From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
> > bounces at antlr.org] On Behalf Of Gokulakannan Somasundaram
> > Sent: Monday, February 01, 2010 6:33 AM
> > To: antlr-interest at antlr.org
> > Subject: [antlr-interest] A bug in C Target Composite grammar
> >
> > Hi,
> >    I found and fixed a runtime bug for C Target w.r.t composite
> > grammar.
> > Please do the necessary.
> >
> > I am copy-pasting the C.stg file lines, that i changed.
> >
> > <if(grammar.directDelegates)>
> >     // Initialize the parsers that we are going to delegate some
> >     // functions to.
> >     //
> >     <grammar.directDelegates:
> >       {g|ctx-><g:delegateName()> = <g.recognizerName>NewSSD(instream,
> > PSRSTATE<grammar.delegators:{g|, <g:delegateName()>}>, ctx);};
> > separator="\n">
> > <endif>
> > <if(grammar.delegators)>
> >     // Install the pointers back to parsers that will delegate us to
> > perform
> > certain functions
> >     // for them.
> >     //
> >     <grammar.delegators:
> >          {g|ctx-><g:delegateName()>            = <g:delegateName()>;};
> > separator="\n">
> >
> >  <if(grammar.directDelegates)>
> >     <grammar.directDelegates:
> >      {g1|
> > <grammar.delegators:{g2|ctx-><g2:delegateName()>-><g1:delegateName()>
> > =
> > ctx-><g1:delegateName()>;}; separator="\n"> };
> >      separator="\n">
> >  <endif>
> >
> > <endif>
> >
> > The first highlighted portion fixed a compile time bug and the second
> > portion fixed the runtime bug. I could see similar lines for lexer
> > also. But
> > i didn't change them. Please take care of this.
> >
> > Thanks,
> > Gokul.
> >****
>
> > 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