[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Inline VALOF
Hi David,
On Tue, Dec 12, 2006 at 10:09:48PM +0000, David May wrote:
> What's made parsing more difficult over the last 40 years?
Syntactically significant whitespace, and the need for programs other
than the compiler to be able to parse the language.
Whitespace isn't sigificant in BCPL, so VALOF is parsed just like any
other construct. In occam-pi, however, VALOF is the only language
feature that allows you to indent by more than one level at a time, or
indent to a position that isn't a multiple of 2. This makes it a bit
more awkward to analyse the layout of an occam program without having a
full occam parser available, which is useful for smart editors or
preprocessors that work with occam programs.
VALOF is also unusual in that it's the only language feature in occam
2.1 that breaks the 0-1-many rule for the number of blocks indented
inside it, and where all the child blocks are not treated the same way
-- although we've since added extended inputs in occam-pi, which do the
same thing.
Semantically VALOF is quite elegant; syntactically it's a bit of an
oddity as things currently stand.
> If you remove VALOF, you remove the ability to express the semantics
> of function calls as substitution.
Yes, that's the argument we came up with too. You can still express the
semantics of function calls using rewriting, but it's no longer a simple
substitution.
Thanks,
--
Adam Sampson <http://offog.org/>