[antlr-interest] tree parser example PDF docs and ANTLR Patte rns (was Re: the tree parser exampl)

lgcraymer lgc at mail1.jpl.nasa.gov
Tue May 7 16:41:44 PDT 2002


--- In antlr-interest at y..., mzukowski at y... wrote:
> Antlr also does have some tree matching routines built in.  See the
> implementations of the methods below in antlr.BaseAST
>     public boolean equals(AST t);
>     public boolean equalsList(AST t);
>     public boolean equalsListPartial(AST t);
>     public boolean equalsTree(AST t);
>     public boolean equalsTreePartial(AST t);
>     public ASTEnumeration findAll(AST tree);
>     public ASTEnumeration findAllPartial(AST subtree);
> 
> I've not needed these for my projects but would be interested in 
hearing how
> people use them.  
> 

These are actually translations of SORCERER match utilities.  I'd be 
surprised if they are in active use: if I remember correctly, Ter used 
them in some of the early SORCERER examples, but they became unused as 
SORCERER matured.  After Gary Funck finished hammering on SORCERER, it 
was a pretty decent tool.  I was surprised to encounter them in ANTLR 
2.

For the findAll and findAllPartial methods to be very useful for 
rewriting, they would need to return pointers to parents or left 
siblings of the matched trees so that references could be patched.

Cheers!

--Loring

> Monty
> www.codetransform.com


 

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



More information about the antlr-interest mailing list