Re: language twiddling, was Infinite look ahead required by C++?

"bartc" <bartc@freeuk.com>
Mon, 08 Mar 2010 11:37:52 GMT

          From comp.compilers

Related articles
[4 earlier articles]
Re: Infinite look ahead required by C++? bartc@freeuk.com (bartc) (2010-02-28)
Re: language twiddling, was Infinite look ahead required by C++? cfc@shell01.TheWorld.com (Chris F Clark) (2010-03-01)
Re: language twiddling, was Infinite look ahead required by C++? gah@ugcs.caltech.edu (glen herrmannsfeldt) (2010-03-03)
Re: language twiddling, was Infinite look ahead required by C++? bobduff@shell01.TheWorld.com (Robert A Duff) (2010-03-05)
Re: language twiddling, was Infinite look ahead required by C++? bobduff@shell01.TheWorld.com (Robert A Duff) (2010-03-05)
Re: language twiddling, was Infinite look ahead required by C++? cfc@shell01.TheWorld.com (Chris F Clark) (2010-03-07)
Re: language twiddling, was Infinite look ahead required by C++? bartc@freeuk.com (bartc) (2010-03-08)
Re: language twiddling, was Infinite look ahead required by C++? cfc@shell01.TheWorld.com (Chris F Clark) (2010-03-10)
Re: language twiddling, was Infinite look ahead required by C++? bobduff@shell01.TheWorld.com (Robert A Duff) (2010-03-12)
Re: language twiddling, was Infinite look ahead required by C++? nevillednz@gmail.com (Neville Dempsey) (2010-03-14)
Re: language twiddling, was Infinite look ahead required by C++? genew@ocis.net (Gene Wirchenko) (2010-04-14)
Re: language twiddling, was Infinite look ahead required by C++? bobduff@shell01.TheWorld.com (Robert A Duff) (2010-04-16)
Re: language twiddling, was Infinite look ahead required by C++? genew@ocis.net (Gene Wirchenko) (2010-04-18)
[1 later articles]
| List of all articles for this month |

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]


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.