From: | vbdis@aol.com (VBDis) |
Newsgroups: | comp.compilers |
Date: | 17 Nov 2000 23:47:08 -0500 |
Organization: | AOL Bertelsmann Online GmbH & Co. KG http://www.germany.aol.com |
References: | 00-11-114 |
Keywords: | design |
Posted-Date: | 17 Nov 2000 23:47:08 EST |
Chris F Clark <cfc@world.std.com> schreibt:
> a = b * c = d /* does this parse as "a = b; *c = d;"
> or "a = (b * (c = d));" */
All your examples are based on ambiguous keywords (characters) for
operators or delimiters. Of course a language should have no such
ambiguous tokens, which can appear before, inside, or after an
expression, unless the next higher frame (line, statement...) is
delimited by other (unambiguous) tokens.
Since we (humans) use line breaks and indentation, to separate items
in source code, a compiler must handle these items, too. At least a
compiler must detect white space and line breaks, and then it doesn't
make a big difference, whether these tokens are ignored, or are
treated as separators or terminators.
AFAIR all existing languages allow for both multiple statements on a
single line, as well as for a single statement extending into
continuation lines. Only the according rules differ, on how to
separate or continue multiple statements, accross lines.
DoDi
[Lots of languages don't permit multiple statements per line. Also,
it seems to me that you want a language to have a certain amount of
syntactic redundancy so that a typo or other small error is less
likely to be something legal but not what you want, e.g. the notorious
Fortran DO 10 I = 1.10 -John]
Return to the
comp.compilers page.
Search the
comp.compilers archives again.