Boost logo

Proto :

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


On 10/21/2010 6:41 PM, Joel de Guzman wrote:
> I like it when we are talking on a conceptual level :-). I think part
> of the difficulty is in combining two domains: language/parsing and OOP.

<nod>

> As much as I do not have any problems with "visitation", it's also
> intersecting with the notion of "semantic actions". If we add yet one
> more set of parlance: schemas and documents (which is not totally
> unrelated -- schemas are basically just grammars), I'm afraid we'll
> add more confusion.

Thanks, Joel. Yes, let's not mix our metaphors. (But I do think that
XML/Schema shares much with Language/Grammar. And a Proto expression is
quite a lot like an XML DOM in that is has a tree structure, and the
Schema describes the valid trees. But yes, we're talking about DSLs and
compiler-construction toolkits, so I can keep the XML/Schema talk to
myself. :-)

> I'd say stick to only one domain's parlance. Since proto is closer to
> the language/parsing domain, I think we should stick to (semantic)actions,
> rules, grammars etc.

This is my feeling as well.

> If you want to go "meta" on parsing, then you might
> get some inspiration on 2-level grammars (inspired by van Wijngaarden
> grammars) with the notion of hyper-rules, etc. This document:
>
> http://www.cl.cam.ac.uk/~mgk25/iso-14977.pdf
>
> gives a better glimpse into 2-level grammars (see Annex A).
>
> "Although the notation (also known as a van Wijngaarden grammar,
> or a W-grammar) is more powerful, it is more complicated and,
> as the authors of Algol 68 recognized, “may be difficult
> for the uninitiated reader”.
>
> I'm not really sure how this relates to the current design, but
> I think we should be getting closer to this domain and it deserves
> some notice.

You're not the first to bring up vW-grammars in relation to Proto.
Someone suggested them to implement EDSL type systems. I spent a good
amount of time reading about them, and could get my head around it. My
understanding is that they're powerfully descriptive, but that building
compilers with vW-grammars is very expensive. I don't really know. I
think I'd need to work with a domain expert to make that happen. Any
volunteers? :-)

-- 
Eric Niebler
BoostPro Computing
http://www.boostpro.com

Proto list run by eric at boostpro.com