Path: csiph.com!eternal-september.org!feeder.eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: >< swap operator Date: Sun, 07 Oct 2018 17:24:30 -0700 Organization: None to speak of Lines: 36 Message-ID: References: <36d546c5-b471-45fc-b87a-8ebebdc0c0b7@googlegroups.com> <9d5c4ae9-47ef-4da0-9b39-e7dbc96ab1be@googlegroups.com> <87va6gjile.fsf@bsb.me.uk> <0EquD.234726$HK2.219472@fx08.iad> <3da81a9f-b4cb-4eb5-8988-9e42cf0c8886@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: reader02.eternal-september.org; posting-host="044f0ceb07b55f0a559303158e3458ae"; logging-data="21172"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18lSj5vYNHfZLaAMaclYSyg" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:lzZA0eDsQUAjXA9ETbkyaUpK110= sha1:baEg9ZaVNnKWTMLP9pETaYCCeMY= Xref: csiph.com comp.lang.c:136409 David Kleinecke writes: > On Sunday, October 7, 2018 at 4:53:44 PM UTC-7, Keith Thompson wrote: [...] >> The phrase "syntax error" does not mean "any error that terminates >> compilation", though I've seen the term used that way. Errors that >> require a diagnostic (and may also terminate compilation) are divided >> between syntax errors and constraint violations (and the #error >> directive, and possibly some cases of undefined behavior). [...] > A compiler writer has a choice of strategies. In the > case of a syntax error it is usually quite fussy to get > back into the flow but a constraint violation can be > reported and compilation resumed. That is my approach - > syntax violations end compilation but a constraint > violation causes a report and the end of code generation, > but code checking continues. Most compilers make some effort to recover from syntax errors. For example, after detecting a missing semicolon, a compiler might in effect insert a semicolon into its internal parse tree so it can diagnose later errors. Such efforts have mixed success. C's grammar, I think, can make recovery particularly difficult compared to some other languages. As a compiler user, error messages after the first syntax error may or may not be meaningful. A particularly clever compiler might use code layout (line breaks and indentation to help it guess what was meant in the presence of a syntax error. -- 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"