Re: Autotrees !!
[email protected] (Jeffrey Franks)
| Newsgroups | perl.recdescent |
|---|---|
| Organization | MotifTools.org |
| Message-ID | <[email protected]> |
Brett Sanger wrote:
>
> > Is there an example of an OO processor
> > that handles the parse tree that autotree
> > produces?
>
> Being pretty new to the whole parsing world, I'd love to see this too.
I'm getting a little closer to figuring it out. The autotree
should be able to be traversed with an object that implements
the Visitor Pattern.
Now, which Visitor implementation should I use? (there are more
than one). The purpose of the Visitor pattern in this case
might just be to enable dual dispatch, and I can see how this
works.
However, there is a problem. The grammar is parsed into autotree
in the order it is received. One transform that I need is to XML.
The chances that every XML element can be emitted based on a
linear parse of the tree is not very good, something will surely
be out of sequence.
Is a more complex tree walker needed that has traversal control?
Or, is this a place that Multiple-dispatch should be applied?
That's why an example or a reference would be very handy.
Surely, someone has worked out the design structure for this
problem before now.
--
Jeffrey L. Franks (Web) http://www.motiftools.org
(Mail) [email protected]