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


Groups > comp.lang.c > #64573

Re: More physical source files

From Keith Thompson <kst-u@mib.org>
Newsgroups comp.lang.c
Subject Re: More physical source files
Date 2015-06-30 15:14 -0700
Organization None to speak of
Message-ID <lnbnfw3kum.fsf@kst-u.example.com> (permalink)
References <36e79c40-a86d-416d-b290-b2de49560c61@googlegroups.com> <mmmt6f$82a$1@dont-email.me> <7cf2be57-a46a-454a-a6cb-0c81d77ed7fb@googlegroups.com> <ln8ub2fstw.fsf@kst-u.example.com> <bad1394d-623e-4ef3-8936-876af70857bb@googlegroups.com>

Show all headers | View raw


David Kleinecke <dkleinecke@gmail.com> writes:
> On Monday, June 29, 2015 at 8:16:36 AM UTC-7, Keith Thompson wrote:
>> David Kleinecke <dkleinecke@gmail.com> writes:
>> [...]
>> > But oddly enough it seems that the label colon could be replaced
>> > everywhere by semicolons and the resulting language could be parsed
>> > exactly the same as C. I am not purposing this - I just pointing out
>> > something I had never observed before.
>> 
>> No, it couldn't.
>> 
>> This program;
>> 
>> int main(void) {
>>     int n;
>>     n:
>>     ;
>> }
>> 
>> is syntactically valid; the "n:" is a label.  If you change the
>> colon to a semicolon, it becomes a reference to the int object.
>> 
>> >                                        It might be necessary to add
>> > an explicit statment that
>> >    identifier SEMICOLON
>> > is a label and not a meaning expression statement.  
>> 
>> That would be a change to the language.
>  
> There is at least one other point where an ambiguity is resolved by
> fiat. But I agree that is a change to the langauge.

Which makes me wonder what the point of what you're doing is, but I
didn't particularly understand it anyway.

> I am thinking of compiler design - not formal adherance to the standard.

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.

> A statment
>    identifier SEMICOLON
> does nothing and any sane compiler will skip over it leaving a 
> warning behind. It is up to the compiler writer, of course, but
> one might correct the "error" by changing the semicolon to a colon
> (implicitly, of course) and warning about the change.

It's valid for two reasons.  First, an expression followed by a
semicolon is a statement (and probably the most common kind of
statement); there was no particular need to limit the expression to one
with side effects.  If you wanted to change that, you'd need to define
the change.  (And then an identifier followed by a semicolon could be
treated as a label; I must have missed the part where you explained why
that's a good thing.)

Second, if the named object is volatile, a reference to it could have a
side effect (though that's going to be system-specific).

> 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.

-- 
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 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