[antlr-interest] pushed antlr build with tree rewriting and composite grammars (java)

Terence Parr parrt at cs.usfca.edu
Sat Jan 12 11:42:45 PST 2008


On Jan 12, 2008, at 10:53 AM, David Holroyd wrote:

> On Thu, Jan 10, 2008 at 04:39:54PM -0800, Terence Parr wrote:
>> http://www.antlr.org/download/build/antlr-2008-01-10.16.tar.gz
>
> I'm having a go at upgrading from 3.0.

Great!

> First little thing I notice is that I need to implement some  
> additional
> methods in  TreeAdaptor.  The only non-obvious thing is the intention
> of,
>
>  setChildIndex(Object,int)
>
> should this result in the child actually changing position?

Nope, just set the index.

> ?  Or is this just for bookkeeping, and the child is already at this
> location?

yep, leave it in same position.

> Maybe my problem is I'm not sure why CommonTree records 'childIndex'  
> and
> does,
>
>  public int getChildIndex() {
>      return childIndex;
>  }
>
> rather than just something like,
>
>  public int getChildIndex() {
>      return parent.children.indexOf(this);
>  }

speed :)

I need index for replacing children during ast rewrite mode in tree  
parsers. :)

also trees now have parent pointers. :)

Ter


More information about the antlr-interest mailing list