|
Boost : |
From: joel de guzman (isis-tech_at_[hidden])
Date: 2001-05-29 21:59:19
From: "Douglas Gregor":
> It is possible to consider a grammar as simply a grammar induced by a
given
> start symbol. I am most interested in this definition (for the reason you
> mention below - reusing parts of parsers) because it seems most pure.
> I think the same thing of a tree. A 'tree' structure makes little sense to
me
> in that a 'tree' is merely the tree induced by a given root node. Any
> recursive data structure can be thought of in this way, and in my opinion
it
> is more clean to think of a nonterminal/tree node/list node/etc in
isolation
> instead of bringing in the larger context of a grammar.
That's one of Spirit's concepts. There's no notion of a start symbol.
Any Rule<> can be a start symbol.
>
> Actually, I'm agreeing with Joel on this :). We'd be better off with
static
> (compile time) polymorphism as far as we can take it. However, it would be
> nice if the user could turn it into runtime polymorphism. For instance, an
> interactive grammar-construction program that would allow, for instance, a
> user to redefine a terminal in an existing grammar as a nonterminal to
slowly
> grow a grammar. I haven't thought about this enough yet to formalize how
it
> would work (sorry).
>
> Doug
>
Actually, a previous version of Spirit uses virtual functions. And true, I
am
aware of the advantages (run-time parsers, hey, the original can even
add rules on-the-fly while the parser is running). Spirit now is in fact a
rewrite of the original Spirit's engine. Now I am rewriting the orig
(now named Life :-) using Spirit as the engine. I am aware that there
will be more uses (and need) for dynamic parsers in the near future.
XML and XML's DTD processing is a prime example.
Cheers,
Joel de Guzman
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk