$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
From: joel de guzman (isis-tech_at_[hidden])
Date: 2001-05-29 22:19:57
From: "John Max Skaller" :
> > Spirit has virtually all the set operators
>
> This may not be natural. Consider the grammar:
>
> int = digit *
> float = digit + ["." digit *]
>
> where [] means 'optional'. Using 'set' operators,
> I have to write
>
> int = digit *
> float = digit+ ["." digit*] - int
Spirit resolves this with the Longest directive.
There's your maximal munch stuff.
>
> whereas the 'natural' intepretation of the first form
> is to resolve ambiguities 'in order or writing'.
> The programming construction
>
> if c1 ..
> else if c2 ..
> else if c3 ..
>
> is actually equivalent to
>
> if c1 ..
> if c2 - c1 ..
> if c3 - c2 - c2 ..
>
> but the explicit sequencing of the first example
> simplifies the expression over the second, setwise,
> construction. This is just one example I can think of
> where set operators might not be clearest.
>
Priorities can resolve this ambiguity.
Spirit has a default priority rule. Alternatives are short-circuited.
The right-most alternative has the highest priority. If this is not
desired, there's the Longest and Shortest directive.
Joel de Guzman