From: Larry Evans (cppljevans_at_[hidden])
Date: 2008-03-04 09:35:09
On 03/03/08 19:29, Eric Niebler wrote:
> Larry Evans wrote:
>> was formed with the same template as an expression... Hmm.. Getting
>> confused again. How can one distinguish a grammar from an expression
>> if both are formed from the same template, i.e. the expr template?
>> Maybe by starting from the base case, the terminal template?
>> IOW, is the following:
>> For any type T:
>> terminal<T> is a grammar type.
>> terminal<T>::type is an expression type.
> Yes. It's also a grammar type. It matches itself (more or less -- see
> the reference for proto::matches<>).
>> If T0,T1,...,Tn are all grammar types, and Tag is an n-ary tag,
>> then expr<Tag,T0,T2,...,Tn> is a grammar type.
> Yes. (Minor correction, expr<Tag, argsN<T0,T1,...,Tn> > is a grammar
>> 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.
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?
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk