Warning: mysqli::__construct(): (HY000/1203): User howardkn already has more than 'max_user_connections' active connections in D:\Inetpub\vhosts\howardknight.net\al.howardknight.net\includes\artfuncs.php on line 21
Failed to connect to MySQL: (1203) User howardkn already has more than 'max_user_connections' active connections
Warning: mysqli::query(): Couldn't fetch mysqli in D:\Inetpub\vhosts\howardknight.net\al.howardknight.net\index.php on line 66
Article <20240618181840.18@kylheku.com>
Deutsch   English   Français   Italiano  
<20240618181840.18@kylheku.com>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!feeds.phibee-telecom.net!3.eu.feeder.erje.net!feeder.erje.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Kaz Kylheku <643-408-1753@kylheku.com>
Newsgroups: comp.lang.c
Subject: Re: Whaddaya think?
Date: Wed, 19 Jun 2024 01:58:57 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 83
Message-ID: <20240618181840.18@kylheku.com>
References: <666ded36$0$958$882e4bbb@reader.netnews.com>
 <87ed8x4zjl.fsf@nosuchdomain.example.com>
 <666f10b7$0$1412896$882e4bbb@reader.netnews.com>
 <v4o7om$er18$1@dont-email.me> <20240617003207.452@kylheku.com>
 <86msnik9a7.fsf@linuxsc.com> <87msnizhmr.fsf@nosuchdomain.example.com>
 <86bk3xixtf.fsf@linuxsc.com> <87tthpycmv.fsf@nosuchdomain.example.com>
Injection-Date: Wed, 19 Jun 2024 03:58:57 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="a089f22f6620d85d02f1b703c80c4bae";
	logging-data="1852862"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1/U6AgUti7iqH+oY5wvhsxEyfxixisWFl8="
User-Agent: slrn/pre1.0.4-9 (Linux)
Cancel-Lock: sha1:tEwxtEmg4ssbKSSQ+/qnJ5oav7M=
Bytes: 3523

On 2024-06-19, Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote:
> Tim Rentsch <tr.17687@z991.linuxsc.com> writes:
>> Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
>>
>>> Tim Rentsch <tr.17687@z991.linuxsc.com> writes:
>>>
>>>> Kaz Kylheku <643-408-1753@kylheku.com> writes:
>>>>
>>>>> Speaking of while, the do/while construct does not require parentheses
>>>>> in order to disambiguate anything, since it has a mandatory semicolon.
>>>>> Yet, it still has them.
>>>>
>>>> It has them to allow an extension for a "loop-and-a-half" control
>>>> structure:
>>>>
>>>>     do statement while ( expression ) statement
>>>>
>>>> and so for example
>>>>
>>>>     do  c = getchar();  while(  c != EOF  )  n++;
>>>>
>>>> to count characters on standard input.
>>>
>>> Oh?  Do you have any evidence that that was the intent? [...]
>>
>> I think you're reading something into my remark that it
>> didn't say.
>
> Or at least that you didn't mean.

FWIW, it would seem that the phrase pattern:

    do statement while expression ;

may be compatible with the proposed extension in a way
manageable via LALR(1) parsing.

I don't see difficulties in recursive descent, either.

The near minimal Yacc grammar pasted below produces no conflicts,
and is only slightly contorted. We treat the ')' token as the
lowest prededence operator, and ';' as highest, which eliminates
conflicts in way that we want.

I can explain why; another way is to remove the %nonassoc declarations,
use "yacc -v", and study the confict details y.output file.

It's not clear whether the grammar can be nicely factored into the form
used in the standard, which makes no use of precedence or associativity.
(But would that be a requirement for leaving room for an extension.)

%{

%}

%nonassoc ')'
%token DO WHILE NUM
%left '+'
%nonassoc ';'

%%

while_statement : DO statement WHILE expr ';'
                | DO statement WHILE '(' expr ')' statement

statement : ';'
          | expr ';'
          | '{' expr '}'
          | '{' '}'
          ;

expr : '(' expr ')'
     | expr '+' expr
     | '+' expr
     | NUM
     ;

%%

-- 
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca