From: | "bartc" <bartc@freeuk.com> |
Newsgroups: | comp.compilers |
Date: | Mon, 08 Mar 2010 11:37:52 GMT |
Organization: | Compilers Central |
References: | 10-02-024 10-02-039 10-02-086 10-02-088 10-03-003 10-03-005 10-03-007 10-03-014 |
Keywords: | syntax, design, comment |
Posted-Date: | 09 Mar 2010 23:26:18 EST |
Chris F Clark wrote:
> BTW, I agree with Bob Duff in that there are other ways to be clear
> and unambiguous. However, initial keywords (especially when they are
> reserved words) are particularly simple to use and generally make
> proving that the language is LL(1) trivial. While this may not be a
> be-all-end-all property for a language to have, it is a good start
> especially for those who are still learning.
>
> For example, the resolution of the dangling else problem, by changing
> the syntax to have a closing terminator on if-statements, results in
> that section of the language being LL(1).
In my design (derived from Algol-68 at one point), an if-statement looks
like:
if s then s else s fi
(where s is any sequence of statements/expressions). I guess that might be
LL(1). But an if-statement can also look like:
( s | s | s )
In this case it doesn't know it's an if-statement until the second "|"
(because ( s | s, s | s ) is another kind of statement). Is this still
LL(1)? I wouldn't have thought so now.
--
Bartc
[I thought Algol-68 used a two-level VW grammar. -John]
Return to the
comp.compilers page.
Search the
comp.compilers archives again.