logo       

Re: Fusion-ifying proto parse trees: msg#00012

parsers.spirit.devel

Subject: Re: Fusion-ifying proto parse trees

dan marsden wrote:
Joel de Guzman wrote:
Given a node, you can know the Nth type from the traversal, right?
Given a node, you can get the Nth element by walking the tree, right?

IOTW, this is possible:
get_element_type<Node, N>::type

and so is this:
get_element<N>(node)

Yes, No?

If yes, then you can keep a reference to the root node
plus an N index, to represent your iterator.

Attached is a crude implementation of a get_element like facility for trees of
unary_op and binary_op nodes
that I knocked together to get some familiarity with proto (v cool btw).


Thanks!


It implements element access by
numbered index, with the numbering being in either preorder, postorder or
inorder sequence. (I'd don't think
inorder numbering will extend to more complex trees though). It might be of
some interest if fusion style iteration
over the trees does prove worthwhile. I've made no attempt to optimize
performance, so it may be doing some pretty
crummy things performance wise.


Wow, cool! I'll have to study this. Have you run any benchmarks against this iteration scheme and the one I checked in a few days ago?


--
Eric Niebler
Boost Consulting
www.boost-consulting.com


-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise