|
Re: Re: Fusion-ifying proto parse trees: msg#00018parsers.spirit.devel
----- Original Message ---- From: Eric Niebler <eric@xxxxxxxxxxxxxxxxxxxx> To: spirit-devel@xxxxxxxxxxxxxxxxxxxxx Sent: Tuesday, 2 May, 2006 12:19:10 AM Subject: [Spirit-devel] 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! No problem! > 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? Is that the 'cons' based sequence building approach? No, I've not run any comparisons so far (it's still quite crude IMO, so the implementation may change during performance testing). Presumably there would be a need for both compile time and run time benchmarks? I'll have a look at doing some sort of comparison if I get chance in the next few days. Thanks Dan ------------------------------------------------------- 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> |
|---|---|---|
| Previous by Date: | Re: Fusion-ifying proto parse trees: 00018, Joel de Guzman |
|---|---|
| Next by Date: | Re: Fusion-ifying proto parse trees: 00018, Eric Niebler |
| Previous by Thread: | Re: Fusion-ifying proto parse treesi: 00018, Joel de Guzman |
| Next by Thread: | Re: Fusion-ifying proto parse trees: 00018, Eric Niebler |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |