Re: question about linker

Liste des GroupesRevenir à cl c  
Sujet : Re: question about linker
De : antispam (at) *nospam* fricas.org (Waldek Hebisch)
Groupes : comp.lang.c
Date : 12. Dec 2024, 03:31:21
Autres entêtes
Organisation : To protect and to server
Message-ID : <vjdhtn$1hp82$1@paganini.bofh.team>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
User-Agent : tin/2.6.2-20221225 ("Pittyvaich") (Linux/6.1.0-9-amd64 (x86_64))
Janis Papanagnou <janis_papanagnou+ng@hotmail.com> wrote:
On 11.12.2024 16:28, David Brown wrote:
On 11/12/2024 09:43, Ike Naar wrote:
On 2024-12-09, Janis Papanagnou <janis_papanagnou+ng@hotmail.com> wrote:
>
An unambiguous grammar is something quite essential; [...]
>
[ dangling-else sample ]
 
Given that the resolution is in the "semantics" section rather than the
"syntax" section, it might seem like a grammatical ambiguity.  But I
don't think it is, technically - the syntax rules say that the set of
tokens making up "if (E1) if (E2) S1 else S2" are valid syntax.  It is
up to the semantics to determine what the code will do here.  (And the
semantics are unambiguous.)
 
I'm a bit ambivalent about that. - Yes, technically it's syntax, it's
syntactically probably correct, and it has a semantical ambiguity that
needs to be resolved. All languages with the dangling-else property do
resolve that. But the syntax could have been defined in a way that such
that a dangling else cannot appear in the first place. (Not in "C" and
descendant languages, of course; that ship has sailed.)

Of course nobody is going to retroactively change C standards.
However, it is well-known how to rewrite grammar so that there
is no "dangling else" ambiguity in the grammar and resulting
parse trees are equivalent to parse trees produced by the current
grammar.  Drawback of such rewrite is that grammar is significantly
bigger, basically most things that can appear iside 'if' must
come in two versions.  Such grammar is harder to understand,
so most languages make pragmatic choice of using simpler grammar
+ extra rule.  And this simpler grammar can be fed into a parser
generator to get parser which resolves "dangling else" as
proscribed by the rule and such parser is likely to be smaller
and more efficient than parser for grammar with conflict
removed.

So, while "dangling else" problem is rather fundamental, using
ambigious grammar is a pragmatic choice.

The other things that I mentioned (type name trouble) is more
problematic: trying to fix it leads to grammar that is not
LR(1).  I think that this grammar is unambigious, but it
would not work with standard parser generators ("dangling else"
rewrite preserves good propeties of grammar and only affects
size).

--
                              Waldek Hebisch

Date Sujet#  Auteur
26 Nov 24 * question about linker382Thiago Adams
26 Nov 24 +* Re: question about linker16Thiago Adams
26 Nov 24 i`* Re: question about linker15Bart
26 Nov 24 i `* Re: question about linker14Thiago Adams
27 Nov 24 i  +* Re: question about linker2BGB
27 Nov 24 i  i`- Re: question about linker1Bart
27 Nov 24 i  +* Re: question about linker5David Brown
27 Nov 24 i  i`* Re: question about linker4Thiago Adams
27 Nov 24 i  i +* Re: question about linker2David Brown
27 Nov 24 i  i i`- Re: question about linker1Thiago Adams
2 Dec 24 i  i `- Re: question about linker1BGB
27 Nov 24 i  `* Re: question about linker6Michael S
27 Nov 24 i   `* Re: question about linker5Thiago Adams
27 Nov 24 i    `* Re: question about linker4Michael S
27 Nov 24 i     +- Re: question about linker1David Brown
28 Nov 24 i     +- Re: question about linker1Tim Rentsch
2 Dec 24 i     `- Re: question about linker1BGB
26 Nov 24 +* Re: question about linker20Bart
26 Nov 24 i`* Re: question about linker19Thiago Adams
26 Nov 24 i `* Re: question about linker18Bart
27 Nov 24 i  +* Re: question about linker3BGB
27 Nov 24 i  i`* Re: question about linker2fir
27 Nov 24 i  i `- Re: question about linker1BGB
27 Nov 24 i  `* Re: question about linker14Bart
27 Nov 24 i   +* Re: question about linker12Thiago Adams
27 Nov 24 i   i+- Re: question about linker1Thiago Adams
27 Nov 24 i   i`* Re: question about linker10Bart
27 Nov 24 i   i +* Re: question about linker6Bart
27 Nov 24 i   i i`* Re: question about linker5Thiago Adams
27 Nov 24 i   i i +* Re: question about linker3Thiago Adams
27 Nov 24 i   i i i`* Re: question about linker2Thiago Adams
27 Nov 24 i   i i i `- Re: question about linker1Bart
27 Nov 24 i   i i `- Re: question about linker1Bart
27 Nov 24 i   i `* Re: question about linker3Thiago Adams
27 Nov 24 i   i  `* Re: question about linker2Bart
27 Nov 24 i   i   `- Re: question about linker1Thiago Adams
28 Nov 24 i   `- Re: question about linker1Tim Rentsch
27 Nov 24 `* Re: question about linker345Waldek Hebisch
27 Nov 24  `* Re: question about linker344Thiago Adams
28 Nov 24   `* Re: question about linker343Keith Thompson
28 Nov 24    `* Re: question about linker342Thiago Adams
28 Nov 24     +* Re: question about linker337Bart
28 Nov 24     i`* Re: question about linker336Keith Thompson
29 Nov 24     i `* Re: question about linker335Bart
29 Nov 24     i  `* Re: question about linker334Keith Thompson
29 Nov 24     i   `* Re: question about linker333Bart
29 Nov 24     i    +* Re: question about linker3Keith Thompson
29 Nov 24     i    i`* Re: question about linker2Bart
29 Nov 24     i    i `- Re: question about linker1Keith Thompson
29 Nov 24     i    `* Re: question about linker329David Brown
29 Nov 24     i     `* Re: question about linker328Bart
29 Nov 24     i      +- Re: question about linker1Ike Naar
29 Nov 24     i      +* Re: question about linker325Michael S
29 Nov 24     i      i+* Re: question about linker322Bart
29 Nov 24     i      ii`* Re: question about linker321Michael S
29 Nov 24     i      ii +* Re: question about linker319David Brown
29 Nov 24     i      ii i`* Re: question about linker318Bart
29 Nov 24     i      ii i +* Re: question about linker164Keith Thompson
29 Nov 24     i      ii i i`* Re: question about linker163Bart
30 Nov 24     i      ii i i `* Re: question about linker162Keith Thompson
30 Nov 24     i      ii i i  +* Re: question about linker95Waldek Hebisch
30 Nov 24     i      ii i i  i+- Re: question about linker1Keith Thompson
30 Nov 24     i      ii i i  i+* Re: question about linker3James Kuyper
30 Nov 24     i      ii i i  ii`* Re: question about linker2Michael S
3 Dec 24     i      ii i i  ii `- Re: question about linker1Tim Rentsch
1 Dec 24     i      ii i i  i`* Re: question about linker90David Brown
1 Dec 24     i      ii i i  i +* Re: question about linker88Bart
1 Dec 24     i      ii i i  i i`* Re: question about linker87David Brown
1 Dec 24     i      ii i i  i i `* Re: question about linker86Bart
2 Dec 24     i      ii i i  i i  `* Re: question about linker85David Brown
2 Dec 24     i      ii i i  i i   `* Re: question about linker84Bart
2 Dec 24     i      ii i i  i i    +* Re: question about linker78David Brown
2 Dec 24     i      ii i i  i i    i+* Re: question about linker72Janis Papanagnou
2 Dec 24     i      ii i i  i i    ii+* Re: question about linker70Bart
2 Dec 24     i      ii i i  i i    iii+* Re: question about linker68David Brown
2 Dec 24     i      ii i i  i i    iiii`* Re: question about linker67Bart
3 Dec 24     i      ii i i  i i    iiii `* Re: question about linker66David Brown
3 Dec 24     i      ii i i  i i    iiii  +* Re: question about linker53Bart
3 Dec 24     i      ii i i  i i    iiii  i`* Re: question about linker52David Brown
3 Dec 24     i      ii i i  i i    iiii  i `* Re: question about linker51Bart
4 Dec 24     i      ii i i  i i    iiii  i  `* Re: question about linker50David Brown
4 Dec 24     i      ii i i  i i    iiii  i   `* Re: question about linker49Bart
4 Dec 24     i      ii i i  i i    iiii  i    `* Re: question about linker48David Brown
4 Dec 24     i      ii i i  i i    iiii  i     +* Re: question about linker24Bart
5 Dec 24     i      ii i i  i i    iiii  i     i`* Re: question about linker23David Brown
5 Dec 24     i      ii i i  i i    iiii  i     i +- Re: question about linker1Janis Papanagnou
5 Dec 24     i      ii i i  i i    iiii  i     i `* Re: question about linker21Bart
6 Dec 24     i      ii i i  i i    iiii  i     i  `* Re: question about linker20David Brown
6 Dec 24     i      ii i i  i i    iiii  i     i   `* Re: question about linker19Bart
6 Dec 24     i      ii i i  i i    iiii  i     i    +* Re: question about linker5Ike Naar
6 Dec 24     i      ii i i  i i    iiii  i     i    i+- Re: question about linker1Bart
7 Dec 24     i      ii i i  i i    iiii  i     i    i+- Re: question about linker1Keith Thompson
7 Dec 24     i      ii i i  i i    iiii  i     i    i`* Re: question about linker2Bart
7 Dec 24     i      ii i i  i i    iiii  i     i    i `- Re: question about linker1Keith Thompson
7 Dec 24     i      ii i i  i i    iiii  i     i    +* Re: question about linker10David Brown
7 Dec 24     i      ii i i  i i    iiii  i     i    i`* Re: question about linker9Bart
7 Dec 24     i      ii i i  i i    iiii  i     i    i `* Re: question about linker8David Brown
7 Dec 24     i      ii i i  i i    iiii  i     i    i  `* Re: question about linker7Bart
7 Dec 24     i      ii i i  i i    iiii  i     i    i   `* Re: question about linker6David Brown
7 Dec 24     i      ii i i  i i    iiii  i     i    i    `* Re: question about linker5Bart
8 Dec 24     i      ii i i  i i    iiii  i     i    i     +* Re: question about linker3Ben Bacarisse
8 Dec 24     i      ii i i  i i    iiii  i     i    i     `- Re: question about linker1David Brown
8 Dec 24     i      ii i i  i i    iiii  i     i    `* Re: question about linker3Waldek Hebisch
5 Dec 24     i      ii i i  i i    iiii  i     +* Re: question about linker15Waldek Hebisch
11 Dec 24     i      ii i i  i i    iiii  i     `* Re: question about linker8James Kuyper
3 Dec 24     i      ii i i  i i    iiii  `* Re: question about linker12Bart
3 Dec 24     i      ii i i  i i    iii`- Re: question about linker1Janis Papanagnou
2 Dec 24     i      ii i i  i i    ii`- Re: question about linker1Bart
2 Dec 24     i      ii i i  i i    i`* Re: question about linker5Bart
4 Dec 24     i      ii i i  i i    `* Re: question about linker5Waldek Hebisch
1 Dec 24     i      ii i i  i `- Re: question about linker1Janis Papanagnou
30 Nov 24     i      ii i i  +* Re: question about linker44Bart
30 Nov 24     i      ii i i  +- Re: question about linker1Janis Papanagnou
1 Dec 24     i      ii i i  `* Re: question about linker21David Brown
30 Nov 24     i      ii i `* Re: question about linker153David Brown
5 Dec 24     i      ii `- Re: question about linker1Tim Rentsch
30 Nov 24     i      i`* Re: question about linker2Tim Rentsch
29 Nov 24     i      `- Re: question about linker1David Brown
28 Nov 24     `* Re: question about linker4Keith Thompson

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal