Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #64599

Re: More physical source files

From Keith Thompson <kst-u@mib.org>
Newsgroups comp.lang.c
Subject Re: More physical source files
Date 2015-07-01 11:21 -0700
Organization None to speak of
Message-ID <lnioa320yd.fsf@kst-u.example.com> (permalink)
References (3 earlier) <ln8ub2fstw.fsf@kst-u.example.com> <bad1394d-623e-4ef3-8936-876af70857bb@googlegroups.com> <lnbnfw3kum.fsf@kst-u.example.com> <56d054c6-5316-46eb-b7b4-686bd405149d@googlegroups.com> <mn15ao$v6o$1@speranza.aioe.org>

Show all headers | View raw


glen herrmannsfeldt <gah@ugcs.caltech.edu> writes:
> David Kleinecke <dkleinecke@gmail.com> wrote:
>> On Tuesday, June 30, 2015 at 3:14:19 PM UTC-7, Keith Thompson wrote:
>
>
> (snip)
>>> I'd say adherence to the standard is a compiler's most important job.
>  
>>> Of course if you want to have a compiler for a non-conforming dialect of
>>> C, that's fine.
>  
> (snip, someone else wrote) 
>>> > To what extent would an error-corecting compiler be conforming?   
>  
>>> That depends on just how the "error-correcting" works.  If it accepts
>>> valid programs and generates correctly behaving code for them, and
>>> diagnoses all syntax errors and constraint violations (and handles the
>>> #error directive correctly), then it's conforming.  If not, it's not.
>
> Error correcting compilers used to be much better. I remember PL/I (F)
> with messages like: "MISSING SEMICOLON, ONE INSERTED." 
> (Most IBM compilers are upper case only, at least for OS/360.)
>
> The compiler would correct the internal representation, which allowed
> it to continue on to find more errors. For example, a missing 
> semicolon on a DECLARE statement, without this correction, might
> lose the declaration for many variables. 
>
> Such seems to be a lost art in compiler technology.

Compilers commonly attempt to correct syntax errors to improve
diagnostics for later errors.  A naive compiler might print an error
message and abort if it sees an identifier where it expects a semicolon;
a smarter compiler might internally insert a semicolon and continue
parsing.

The Ada compiler I worked on did this.  You could feed it a chunk of
English text and it would insert, delete, and/or replace tokens until it
was syntactically valid Ada (often the result would be empty).  But it
did this *only* for the purpose of reporting errors; a single syntax
error would set an internal flag that would prevent it from generating
any code.

If you have a very fast compile-and-edit cycle, this kind of thing isn't
as important; you can compile, fix the first error reported, and compile
again.

> (snip) 
>> The error I had in maind is using "a.b" instead of "a->b" when a is a
>> pointer to a struct/union. Easy to detect and correct. The error IMO
>> makes for a prettier source code.
>
> I was wondering once why Java has the . but not the ->. 
> Seems to me that in Java, you only have references, so they
> could have used only ->, but it makes more sense to use .
>  
>> I gather that error correcting would be possible in a conforming
>> compiler. It is strictly compiling where that is not possible.
>
> Are there any ambiguous cases between . and ->?

No.  The prefix of `.` must be a struct or union; the prefix of `->`
must be a pointer to a struct or union.  There's no overlap.

>> Hum. I need to think what other errors (besides the "a.b" error) I am
>> seriously interested in correcting. The colon idea, which was not a  
>> serious suggestion, perhaps.
>
> As long as you only allow things which are otherwise not defined
> by the standard, all is fine.  You can't change the meaning of
> things that the standard allows.  The colon idea could do that.

But diagnostics are still required.

-- 
Keith Thompson (The_Other_Keith) kst-u@mib.org  <http://www.ghoti.net/~kst>
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"

Back to comp.lang.c | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

More physical source files David Kleinecke <dkleinecke@gmail.com> - 2015-06-27 11:19 -0700
  Re: More physical source files Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-06-27 11:54 -0700
    Re: More physical source files Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-06-27 21:20 +0100
  Re: More physical source files Bartc <bc@freeuk.com> - 2015-06-27 20:24 +0100
    Re: More physical source files David Kleinecke <dkleinecke@gmail.com> - 2015-06-29 07:14 -0700
      Re: More physical source files Keith Thompson <kst-u@mib.org> - 2015-06-29 08:16 -0700
        Re: More physical source files David Kleinecke <dkleinecke@gmail.com> - 2015-06-30 08:24 -0700
          Re: More physical source files Robert Wessel <robertwessel2@yahoo.com> - 2015-06-30 12:15 -0500
          Re: More physical source files Keith Thompson <kst-u@mib.org> - 2015-06-30 15:14 -0700
            Re: More physical source files David Kleinecke <dkleinecke@gmail.com> - 2015-07-01 08:38 -0700
              Re: More physical source files glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-07-01 16:43 +0000
                Re: More physical source files Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-07-01 18:52 +0100
                Re: More physical source files Keith Thompson <kst-u@mib.org> - 2015-07-01 11:21 -0700
                Re: More physical source files glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-07-01 18:36 +0000
                Re: More physical source files Richard Damon <Richard@Damon-Family.org> - 2015-07-01 22:33 -0400
                Re: More physical source files glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-07-02 19:11 +0000
              Re: More physical source files Keith Thompson <kst-u@mib.org> - 2015-07-01 11:08 -0700
                Re: More physical source files Richard Damon <Richard@Damon-Family.org> - 2015-07-01 22:30 -0400
                Re: More physical source files David Kleinecke <dkleinecke@gmail.com> - 2015-07-02 08:29 -0700
                Re: More physical source files Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-07-02 17:56 +0100
                Re: More physical source files James Kuyper <jameskuyper@verizon.net> - 2015-07-02 13:21 -0400
                Re: More physical source files David Kleinecke <dkleinecke@gmail.com> - 2015-07-03 08:54 -0700
                Re: More physical source files James Kuyper <jameskuyper@verizon.net> - 2015-07-04 12:23 -0400
                Re: More physical source files Martin Shobe <martin.shobe@yahoo.com> - 2015-07-04 11:36 -0500
                Re: More physical source files Keith Thompson <kst-u@mib.org> - 2015-07-02 16:42 -0700
                Re: More physical source files David Kleinecke <dkleinecke@gmail.com> - 2015-07-03 08:54 -0700
                Re: More physical source files Keith Thompson <kst-u@mib.org> - 2015-07-03 10:05 -0700
                Re: More physical source files glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-07-03 21:57 +0000
                Re: More physical source files James Kuyper <jameskuyper@verizon.net> - 2015-07-04 00:30 -0400
                Re: More physical source files David Kleinecke <dkleinecke@gmail.com> - 2015-07-04 08:08 -0700
                Re: More physical source files Richard Damon <Richard@Damon-Family.org> - 2015-07-04 12:21 -0400
                Re: More physical source files David Kleinecke <dkleinecke@gmail.com> - 2015-07-05 09:22 -0700
                Re: More physical source files David Kleinecke <dkleinecke@gmail.com> - 2015-07-05 09:49 -0700
                Re: More physical source files Keith Thompson <kst-u@mib.org> - 2015-07-05 18:16 -0700
                Re: More physical source files David Kleinecke <dkleinecke@gmail.com> - 2015-07-06 08:37 -0700
                Re: More physical source files James Kuyper <jameskuyper@verizon.net> - 2015-07-06 12:56 -0400
                Re: More physical source files Keith Thompson <kst-u@mib.org> - 2015-07-06 11:59 -0700
                Re: More physical source files James Kuyper <jameskuyper@verizon.net> - 2015-07-06 15:45 -0400
                Re: More physical source files Keith Thompson <kst-u@mib.org> - 2015-07-06 13:14 -0700
                Re: More physical source files Philip Lantz <prl@canterey.us> - 2015-07-07 01:10 -0700
                Re: More physical source files David Kleinecke <dkleinecke@gmail.com> - 2015-07-07 08:00 -0700
                Re: More physical source files David Kleinecke <dkleinecke@gmail.com> - 2015-07-07 07:55 -0700
                Re: More physical source files James Kuyper <jameskuyper@verizon.net> - 2015-07-07 13:13 -0400
                Re: More physical source files David Kleinecke <dkleinecke@gmail.com> - 2015-07-08 08:35 -0700
                Re: More physical source files James Kuyper <jameskuyper@verizon.net> - 2015-07-08 12:31 -0400
                Re: More physical source files David Kleinecke <dkleinecke@gmail.com> - 2015-07-09 08:50 -0700
                Re: More physical source files Richard Heathfield <rjh@cpax.org.uk> - 2015-07-09 16:56 +0100
                Re: More physical source files Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-07-09 13:31 -0700
                Re: More physical source files Keith Thompson <kst-u@mib.org> - 2015-07-09 15:03 -0700
                Re: More physical source files Ian Collins <ian-news@hotmail.com> - 2015-07-10 10:54 +1200
                Re: More physical source files James Kuyper <jameskuyper@verizon.net> - 2015-07-09 14:32 -0400
                Re: More physical source files James Kuyper <jameskuyper@verizon.net> - 2015-07-05 13:41 -0400
                Re: More physical source files Richard Damon <Richard@Damon-Family.org> - 2015-07-05 14:17 -0400
                Re: More physical source files Keith Thompson <kst-u@mib.org> - 2015-07-04 12:36 -0700
                Re: More physical source files Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-07-04 15:19 -0700
                Re: More physical source files Keith Thompson <kst-u@mib.org> - 2015-07-04 15:42 -0700
                Re: More physical source files James Kuyper <jameskuyper@verizon.net> - 2015-07-04 19:04 -0400
                Re: More physical source files Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-07-05 03:25 -0700
                Re: More physical source files Keith Thompson <kst-u@mib.org> - 2015-07-05 09:18 -0700
                Re: More physical source files James Kuyper <jameskuyper@verizon.net> - 2015-07-05 14:11 -0400
                Re: More physical source files Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-07-05 13:41 -0700
                Re: More physical source files James Kuyper <jameskuyper@verizon.net> - 2015-07-04 12:50 -0400
      Re: More physical source files Bartc <bc@freeuk.com> - 2015-06-29 17:20 +0100
  Re: More physical source files Rosario19 <Ros@invalid.invalid> - 2015-06-28 11:57 +0200

csiph-web