Article View: comp.std.c
Article #3471Re: Multi-level break and elimination of GOTO
From: Paul Long
Date: Sat, 11 Nov 1995 10:28
Date: Sat, 11 Nov 1995 10:28
42 lines
2071 bytes
2071 bytes
In article <480eio$2uf@news0.rain.rg.net> Paul Long <plong@perf.com> writes:
>Lawrence Kirby <fred@genesis.demon.co.uk> wrote:
>[snip]
>>Writing it as:
>>
>>do outer
>>{
>>} while ()
>>
>>seems to be most consistent with the other constructs.
>
>It's hard to parse. As an experiment, awhile back I added Andrew's
>label to a YACC grammar for Standard C. YACC reported an ambiguity
>with a label after the "do." I believe it had something to do with
>YACC not having enough lookahead. For example, the grammar could
>probably be expressed with an LALR(2) YACC.
Whoops, I remembered wrong! It's not simply that there is a conflict
(specifically, a shift/reduce conflict), the problem is that, as
Charles Fu indicated in another article, the grammar is ambiguous
and no amount of lookahead will help. Expanding on what Charles
wrote, this looks like a labeled do with an empty statement, right?
do outer
;
while (0);
Okay, but in the following form, it also looks like an unlabeled do
with a statement that contains a single identifier.
do
outer;
while (0);
If I can't figure out what it is, neither can the compiler. Let's
try something else, or better yet, let's give up. :-)
Paul Long plong@perf.com http://www.teleport.com/~pciwww/
"A perfect method should not only be an efficient one, as respects
the accomplishment of the objects for which it is designed, but
should in all its parts and processes manifest a certain unity and
harmony." - George Boole, _An Investigation of the Laws of Thought_
Technical Details
Message-ID:
<481trh$cuj@news0.rain.rg.net>Path:
arc1-ca.pugleaf.net!newsfeed.internetmci.com!psgrain!rainrgnews0!plongReferences:
<47s7l0$r18@news.mel.aone.net.au> <815950407snz@genesis.demon.co.uk> <480eio$2uf@news0.rain.rg.net>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!newsfeed.internetmci.com!psgrain!rainrgnews0!plong From: plong@perf.com (Paul Long) Newsgroups: comp.std.c,comp.lang.c Subject: Re: Multi-level break and elimination of GOTO Date: 11 Nov 1995 10:28:01 GMT Organization: Performance Computing Inc., Beaverton, OR Message-ID: <481trh$cuj@news0.rain.rg.net> References: <47s7l0$r18@news.mel.aone.net.au> <815950407snz@genesis.demon.co.uk> <480eio$2uf@news0.rain.rg.net> NNTP-Posting-Host: yosemite.perf.com