On 04/10/10 20:45, Eric Niebler wrote:
I'm not opposed to such a thing being in Proto, but I (personally) don't
feel a strong need. I'd be more willing if I saw a more strongly
motivating example. I believe Joel Falcou invented something similar.
Joel, what was your use scenario?
NT2 ;)

More specifically, all our transform are built the same way:
visit the tree, dispatch on visitor type + tag and act accordignly.
It was needed for us cause the grammar could NOT have been written by hand
as we supprot 200+ functions on nt2 terminal. All our code is somethign like
"for each node, do Foo" with variable Foo depending on the pass and duplicating
the grammar was a no-no.

We ended up with somethign like this, except without switch_ (which I like btw), so we can easily add new transform on the AST from the external view point of user who didn't have to know much proto. As I only had to define one grammar (the visitor) and only specialisation of the
visitor for some tag, it compiled fast and that was what we wanted.

Thomas, why not showign the split example ? It's far better than this one and I remember I and Eric
weren't able to write it usign grammar/transform back in the day.
_______________________________________________
proto mailing list
proto@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/proto

Reply via email to