Path: csiph.com!news.swapon.de!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: "The long goodbye to C" by Eric Raymond Date: Thu, 16 Nov 2017 10:57:57 -0800 Organization: None to speak of Lines: 31 Message-ID: <871skyyrt6.fsf@kst-u.example.com> References: <4QePB.13018$bN1.2070@fx14.am4> <87o9o217gv.fsf@bsb.me.uk> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: reader02.eternal-september.org; posting-host="c0732fd20b87a32d7f44c84be981d0b2"; logging-data="1506"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/dIOAOsP8//OHgfyaXSsFc" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) Cancel-Lock: sha1:/JxwJ7dPqh57CQIohlQODJMBD9Y= sha1:N4aPQCTEcgzViB+bg4Ebz/ChMf8= Xref: csiph.com comp.lang.c:122743 Malcolm McLean writes: > On Thursday, November 16, 2017 at 5:03:54 PM UTC, Ben Bacarisse wrote: >> Malcolm McLean writes: [...] >> > There's also a subtle problem >> > with the typedef system which I keep understanding then forgetting, >> > something to do with the type of grammar that describes C. >> >> You probably mean the fact that once a name has been defined as a type >> it plays a different syntactic role compared to other identifiers. >> Normally >> >> x f(void) { return 42; } >> >> is a syntax error, but when preceded by typedef int x; it's fine. >> > Yes, it means that the grammar isn't what is called "context free" which > has big implications, but I forget the details. The "big implications" are that it's a little tricky to implement a parser for C. The parser needs feedback from the symbol table. This is because typedefs were added relatively late, on top of an existing grammer that was, as far as I know, context free. It's mildly annoying, but it's a solved problem. -- Keith Thompson (The_Other_Keith) kst-u@mib.org Working, but not speaking, for JetHead Development, Inc. "We must do something. This is something. Therefore, we must do this." -- Antony Jay and Jonathan Lynn, "Yes Minister"