|
Boost : |
From: John Max Skaller (skaller_at_[hidden])
Date: 2001-05-29 12:33:29
joel de guzman wrote:
> So, if you have
> > a high enough level 'grammar', decoupling the semantic
> > actions becomes more viable.
> How high is high enough?
I don't know. A test would be:
if you can write a syntax specification for a practical
language including expression of a reasonable number
of constraints (which is non-trivial).
> 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
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.
-- John (Max) Skaller, mailto:skaller_at_[hidden] 10/1 Toxteth Rd Glebe NSW 2037 Australia voice: 61-2-9660-0850 checkout Vyper http://Vyper.sourceforge.net download Interscript http://Interscript.sourceforge.net
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk