Boost logo

Boost Users :

From: David Abrahams (dave_at_[hidden])
Date: 2006-09-14 15:11:39


Jens Theisen <jth02_at_[hidden]> writes:

> Joel de Guzman <joel_at_[hidden]> writes:
>
>> Well, the proper mailing list is:
>> https://lists.sourceforge.net/lists/listinfo/spirit-general
>
> It also fits very well into this thread.
>
>> Yeah. You did miss something. The closure members can be initialized.
>> See "Initializing closure variables" section in http://tinyurl.com/85hbq
>
> And, to stick with my example, what would be a good initialisation for
> a plus_expression?
>
> You don't want to replace default construction with a copy from what's
> conceptionally a default. The topic question of this thread is about
> whether or not you should construct objects prior to when you have
> enough information to meaningfully do so, and for returning parsed
> values in spirit, this is neither at closure contstruction time nor at
> rule/grammar invocation time.
>
> I have the impression that spirit either forces you to do exactly that
> or else use actions, which is even more messy.
>
> Am I correct in that observation?

I may totally misinterpreting the question here, but in case I'm
not...

Spirit has to use "funny assignment semantics" for rules so that
grammars can be recursive. There will always be some symbols whose
identity needs to be established so they can be used on the RHS of
other rules before they can really be initialized as rules. I think
that's a reasonable trade-off to make in order to get syntax that's
close to traditional EBNF.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net