[antlr-interest] Tree walking Q

Gerald B. Rosenberg gbr at newtechlaw.com
Sat Jun 4 18:48:44 PDT 2005


At 07:27 PM 6/4/2005, Bryan Ewbank wrote:

>Another option, perhaps, that may not work as well in general, is:
>
>    walker :
>       #( op:.
>          { preorder(#op); }
>          (walker)*
>          { postorder(#op); }
>       );

Thanks for this suggestion.  It is really close -- maybe if I can combine 
it with syntactic predicates ...

>At the same time, I'm a bit surprised that you say you can't define
>explicit rules for the tree-parser.

Yes...

>If you can't define it, can you be sure it's correct?

Because by definition, the rule set is open-ended.  I am attempting to 
apply ANTLR to a natural language processing problem where instances of 
structured text are embedded in blocks of ordinary text.  The structured 
text is sufficiently regular for ANTLR, with a fair bit of care in 
constructing the grammar, to be happy recognizing bits and pieces of the 
structured text.  Now I need to collect and assemble the parts, hence 
tree-walking while ignoring the unstructured stuff.  Cannot throw the 
unstructured text away, because for example there are proximity factors 
that influence assembly of the structured text.

So, just need the tree-walker to quietly skip over the unstructured stuff.

Thanks very much for the help,
Gerald
----
Gerald B. Rosenberg, Esq.
NewTechLaw
285 Hamilton Avenue, Suite 520
Palo Alto, CA  94301-2576

650.325.2100  (office)  /  650.703.1724  (cell)
650.325.2107  (fax)

www.newtechlaw.com




More information about the antlr-interest mailing list