Boost logo

Boost :

From: Eric Niebler (eric_at_[hidden])
Date: 2008-03-04 12:38:07


Larry Evans wrote:
> On 03/03/08 19:29, Eric Niebler wrote:
> > Larry Evans wrote:
> >> If T0,T1,...,Tn are all expression types, and Tag is an n-ary tag,
> >> then expr<Tag,T0,T,...,Tn> is an expression type.
> >
> > Yes. It is also a grammar type that matches itself.
> >
> [snip]
> Hmm... So a grammar is an expression and an expression is a grammar.
> Sorta like lisp where a program is data and data is a program.
> I guess proto::matches is like lisp eval. Is that sorta right?

An expression is a grammar, but a grammar is not an expression. For
example, not_<X> is only a grammar and not an expression.

There's a similarity between lisp macros and proto transforms. They both
operate on executable code in the form of expression trees. We haven't
spoken about transforms yet, but just as there is a relation between
expressions and grammars, there's also a relation between grammars and
transforms. I certainly feel like there needs to be a section in Proto's
docs that calls out these relationships explicitly.

-- 
Eric Niebler
Boost Consulting
www.boost-consulting.com

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