From: | wclodius@aol.com (Wclodius) |
Newsgroups: | comp.compilers |
Date: | 14 Nov 2000 13:06:22 -0500 |
Organization: | AOL http://www.aol.com |
References: | 00-11-069 |
Keywords: | design |
Posted-Date: | 14 Nov 2000 13:06:22 EST |
>To have a language without statement terminators (or statement
>separators) and without line continuations and still having an
>unambiguous grammar, one must have distinct statement starting tokens
>that can be recognized as starting a new statement (rather than
>continuing the list). Although, if the language does not have to be
>LR(1) or LL(1), you can put the distinct statement starting tokens one
>or two tokens into the rule.
Is this really true?
In some of the languages I am familiar with it appears that a
substantial subset could be parsed into statements using a rule such
as:
If a name is identified (preferably, but not necessarily, after an end
of line) such that no open brackets remain, and the name is not
immediately preceded by an operator or punctuation then a new
statement begins.
Mind you while I believe that it is possible to construct a language
using such a rule, properly reporting some common type of errors may
be more difficult than in languages with explicit terminators or
continuations, particularly if the language allows assignment
expressions as well as assignment statements. This sort of rule also
may not be well suited for most parser generators.
Note also that some forms of some forms of continuations or teminators
need not be obvious, e.g., the use indentation to indicate that the
line contiues the previous statement.
William B. Clodius
Return to the
comp.compilers page.
Search the
comp.compilers archives again.