[antlr-interest] tree parser example PDF docs and ANTLR Patte rns (was Re: the tree parser exampl)
Terence Parr
parrt at jguru.com
Wed May 8 08:42:49 PDT 2002
On Tuesday, May 7, 2002, at 04:41 PM, lgcraymer wrote:
> --- 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.
Yeah, there was a tree "scanf" routine in old days that returned
pointers to various nodes like this:
tscant("#(DOT %1:ID %2:ID)", &a, &b);
that would set pointers a and b for you :) Handy. It was kinda like
SORCERER interpreted.
Ter
--
Co-founder, http://www.jguru.com
Creator, ANTLR Parser Generator: http://www.antlr.org
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list