Sujet : Re: question about linker
De : antispam (at) *nospam* fricas.org (Waldek Hebisch)
Groupes : comp.lang.cDate : 11. Dec 2024, 15:39:47
Autres entêtes
Organisation : To protect and to server
Message-ID : <vjc87h$1apid$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))
bart <
bc@freeuk.com> wrote:
On 09/12/2024 18:46, Janis Papanagnou wrote:
On 07.12.2024 16:33, Bart wrote:
So you're a parser and you see this:
>
do ... while
>
How do you know whether that 'while' starts a new nested loop or
terminates this one?
Because there's the '...' in between that answers that question.
Oh, I see. That answers everything! Including having a '...' that
includes statements starting with 'while'.
C grammar is not LL(1), that is you can not recognize a construct
looking at its first token. You need the whole construct and
sometimes also the following token. And there are also well
known troubles due to type names and "dangling else". So C
is almost, but not entirely LR(1). But the description, that
is grammar + extra rules is unambigious, not very complex and
it is well-known how to parse C with good efficiency. You
can write confusing code, but the are ways to make it more
readible.
-- Waldek Hebisch