|
Boost : |
From: Vladimir Prus (ghost_at_[hidden])
Date: 2001-05-31 05:41:18
Joel de Guzman wrote
>> I've just got another idea about Spirits's syntax. Consider grammar in C++
>> standard (std::A). It uses "-seq" for repetition (+) and "opt" subscript
for
>> optinal constructs. What about adding such syntax to Spirit
>The iterator syntax, as it stands, is complete as it is IMO. Adding
>another way to do things will give us three ways. I think extensions
>such as these are best to be Spirit Directives in the form:
> Directive[ expr ]
Complete, true. But is it the best? I find that prefix "*" and "+" are
unnatural. "nonterminal(1, more)" for "+" is better, but overly verbose,
"nonterminal-seq", in my opinion, is quite natural and consice notation.
>> Rule<> points = Point-seq ; // and similary for opt
>>
>> I think it is possible to implement it in a few minutes.
>>
>> Also, what about using "," for sequencing? Was this suggestion considered?
>That was suggested a couple of times.
>Is it a viable operator for sequencing?
>I'm afraid to say...
> [snip]
>I always wished I could use the comma. I did, initially.
>But I got bitten when I typed in:
>r = a, b | c;
Actually, *this* code can be made to work. Blitz library uses this syntax for
array assigments.
Array<int> a;
a = 1, 2, 3, 4, 5;
This is acomplished by making operator= return special object. This is not
likely to work in case of initialzation, anyway.
-- Regards, Vladimir
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk