[antlr-interest] Re: 2.7.2a4 ANTLR/C# - build ok, panic shutdown

slightlynew gackle at shaw.ca
Thu Dec 5 18:01:03 PST 2002


Ter,

> I updated this java/action.g rule [...]
> To allow the 3rd arg.  Hmm....

Oh no, that's definitely there.  Let me try to express this more 
clearly.  I tried two separate things, one with Java Antlr and one 
with C#.  Neither worked.

(1) For C#, I ported your changes to java/action.g to 
csharp/action.g.  In other words, I added your new AST_CONSTRUCTOR 
rule to the C# version.  This didn't work, but I didn't really expect 
it to, because Micheal had already implied it wouldn't until the 
2.7.2a6 C# codegen comes out.  And he has since confirmed that.

(2) For Java, I didn't have to change action.g at all, because you'd 
already done so.  I was just trying to use it.  I modified a grammar 
to pass a third argument to an AST constructor, and then tried to run 
java Antlr on it.  It didn't work.  In fact, I got the same syntax 
error as with the C#: "unexpected ','".  This was why I asked, "Is 
there something else one needs to do, to get Antlr to use the new 
action.g?"  The answer is "yes" in the C# case because 2.7.2a6 isn't 
out yet.  But what about the Java case?

Maybe there are some crossed wires and I wasn't really using the Java 
2.7.2a6 codegen... but I definitely changed my grammar to 
say "Language = Java" instead of C#.

- Daniel

--- In antlr-interest at y..., Terence Parr <parrt at j...> wrote:
> 
> On Wednesday, December 4, 2002, at 03:08  PM, slightlynew wrote:
> > What I wasn't able to get working in Antlr 2.7.2a6 was that third
> > parameter that Terence added to the AST constructor syntax: #
> > [FOO, "Foo", "FooNode"] (or something like that!)  I couldn't get
> > that to work either with Java or C# (having ported Terence's 
changes
> > to the C# action.g).  Antlr rejects the third parameter with a 
syntax
> > error saying "unexpected ','".  Is there something else one needs 
to
> > do, to get Antlr to use the new action.g?
> 
> Hmm...the latest version should have that.  I could have sworn I 
tested 
> that.  I updated this java/action.g rule:
> 
> protected
> AST_CONSTRUCTOR!
>          :       '[' (WS)? x:AST_CTOR_ELEMENT (WS)?
>                  (',' (WS)? y:AST_CTOR_ELEMENT (WS)? )?
>                  (',' (WS)? z:AST_CTOR_ELEMENT (WS)? )? ']'
>                  {
>                  String args = x.getText();
>                  if ( y!=null ) {
>                          args += ","+y.getText();
>                  }
>                  if ( z!=null ) {
>                          args += ","+z.getText();
>                  }
>                  $setText(generator.getASTCreateString(null,args));
>                  }
>          ;
> 
> To allow the 3rd arg.  Hmm....
> 
> Ter
> --
> Co-founder, http://www.jguru.com
> Creator, ANTLR Parser Generator: http://www.antlr.org
> Lecturer in Comp. Sci., University of San Francisco


 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 



More information about the antlr-interest mailing list