Boost logo

Proto :

Subject: Re: [proto] Visitor Design Pattern
From: Eric Niebler (eric_at_[hidden])
Date: 2010-10-24 01:16:10

On 10/23/2010 5:10 PM, Joel de Guzman wrote:
> On 10/24/2010 2:18 AM, Thomas Heller wrote:
>> On Saturday 23 October 2010 19:47:59 Eric Niebler wrote:
>>> On 10/23/2010 10:45 AM, Thomas Heller wrote:
>>>> Why not just rule? Less characters to type.
>>> I almost called it "rule", but *everything* in Proto is a rule including
>>> proto::or_ and proto::switch_. What makes these rules special is that
>>> they have a name.
>> True. But you could look at proto::or_ and proto::switch_ or any other
>> already exisiting rules as anonymous rules. While rule or named_rule
>> explicitly name them.
> Well, in parsing land, rules are always named. There's no such thing
> as anonymous rules, AFAIK.

I think there is, at least in the context we're discussing. For
instance, in Spirit, you might have:

rule<> r = (this >> that) [action1] | (the >> other) [action2] ;

We're discussing the ability to make action1 and action2 external and
pluggable. To do that, you'd look them up by the "rules" (this>>that)
and (the>>other). Those don't have names.

Regardless, I feel that since assigning a name is the sole purpose of
thing, that "named_rule" is the right choice.

Now, what to call the traveral/algorithm/action/on thingy. None of those
feel right. Maybe if I describe in words what it does, someone can come
up with a good name. Given a Proto grammar that has been built with
named rules, and a set of actions that can be indexed with those rules,
it creates a Proto algorithm. The traversal is fixed, the actions can
float. It's called <insert good name here>.

> What's the counterpart of "parser" in the
> proto world?

The C++ compiler. :-)

Eric Niebler
BoostPro Computing

Proto list run by eric at