Boost logo

Boost :

From: Hartmut Kaiser (hartmut.kaiser_at_[hidden])
Date: 2008-03-25 20:00:37


Eric,

Changed topic to avoid getting off topic :-P

> Hartmut Kaiser wrote:
> >> Joel de Guzman wrote:
> >>> In due time, I'll be using Dan traversal library.
> >> With Proto? Or as a replacement for Proto? How do you intend to use
> >> Dan's code in Spirit-2?
> >
> > It will be used to transform the data structures (well, currently not
> the
> > 'structure' itself, but the contents) as generated by a parser. The
> > transformed data items then could be feed back to a generator to
> create some
> > transformed output.
>
> OK, parsing builds a DOM, and the traversal library manipulates the
> DOM.

Exactly.

> > OTOH, I could see the possibility to use Spirit-2 parsers directly
> with the
> > traversal library. It should be possible and very powerful to use a
> Spirit-2
> > (parser) grammar to describe the node types to transform.
>
> Not sure I get this part. If the result of the parse is a DOM, then the
> Spirit grammar is like the schema. So ... you would be annotating your
> schema with attribute transforms? That would be like semantic actions,
> except they would be applied to the DOM after the parse completes?

The traversal library exposes an interface requiring to specify the 'type'
of the nodes to apply a certain action to. OTOH, the types of the DOM
generated by Spirit parsers may get fairly complicated. So the idea is to
use a Spirit-2 parser grammar to describe the type of the DOM node to
modify. This works, because Spirit-2 parsers are fully attributed and any
grammar essentially defines the (set of possible) data structure(s)
generated by the corresponding parser. Certainly, you won't be able to
describe any DOM, but only those generated by a Spirit-2 parser.

So the answer to your question is no. There is no need to attribute the
schema since the parser described by the grammar already is (implicitly)
attributed.

Hope this makes sense now.
Regards Hartmut


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk