binary selectors ambiguity and space
Wolfgang Helbig
helbig at Lehre.BA-Stuttgart.DE
Sun May 14 05:58:47 UTC 2006
>One way would be to force user to introduce these separators, as proposed by
>Wolfgang, but i dislike it because user could not write anymore x-1.
This is not what I intended. The notation as proposed by me requires a separator
only when needed to resolve ambiguities. The separator separates a binary
selector from an adjacent "special_character". The separator could be a space.
But also any other character that must not occur in a binary selector. Like a
letter or a digit, or, to be more explicit, any character that is not a "special
character". Just like a nonalphanumeric character is required to seperate
adjacent identifiers. With binary selectors, a space is required only when
the binary selector consists of one character
AND
the next character would be a "special character"
So "x+-3" would be parsed as "x" "+-" "3". And only if you want it to be
parsed as "x" "+" "-3", you need to hit the large key to write "x+ -3".
What I mean seems best expressed by the wordings from the C Reference Manual:
http://www.ba-stuttgart.de/~helbig/os/v6/doc/c.ps
"In general blanks, tabs, newlines, and comments as described below are ignored
except as they serve to separate tokens. At least one of these characters is
required to separate otherwise adjacent identifiers, constants, and certain
operator-pairs" (Documents for Use with the Unix Time Sharing System, Sixth
Edition, C Reference Manual, page 1, as distributed with Unix Version 6)
You find a "separator" already in the Algol 60 report.
http://www.masswerk.at/algol60/report.htm
where it is neatly defined as a nonterminal. So, geographically, "separator"
made it from Norway, via Switzerland (Pascal, Modula, Oberon) to the US East
Cost (New Jersey), but then disappeared on its way to the US West Cost. The Blue
Book doesn't mention it, instead it seems to be used silently by Smalltalk to
separate adjacent identifiers in "message patterns". Kind of sloppy.
Greetings
Wolfgang
--
Weniger, aber besser.
More information about the Squeak-dev
mailing list
|