🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.misc
Article #6412

Re: Language Design, or: is C's Grammar Context Free

#6412
From: Norman Diamond
Date: Thu, 20 Apr 1989 12:42
48 lines
2107 bytes
Some unknown poster once asked:

>>>>	. . . { T (x); . . . }
>>>> How should the construct be parsed?

In article <9382@dasys1.UUCP> aj-mberg@dasys1.UUCP (Micha Berger) writes:

>Well the sataement cannot be a decleration for x, since x is in
>parenthasis. It cannot be a decleration for T (using ANSI's new format),
>since it has no type.

1.  It can be a declaration for x.  If your compiler rejects this:

  typedef int T;
  main ()
  {
      printf ("hello ");
      {
          T (x);
          x = 3;
          printf ("world.\n");
      }
  }

then your compiler is broken.

2.  Before ANSI standardized existing practice, it could have been a
declaration for T, as you hint (though not when T was typedef'ed).

>	My point was about something else. I felt people were trying to force
>the statement to read along the same lines as:
>
>	main() {
>		int T(x)
>		int x;
>		{
>		};
>		...
>	}

Then maybe you should have read the example before answering.
Your first answer was still out to lunch, and you insulted the
wrong language.  Your second answer is still out to lunch too.

Norman Diamond, Sony Computer Science Lab (diamond%csl.sony.jp@relay.cs.net)
  The above opinions are my own.   |  Why are programmers criticized for
  If they're also your opinions,   |  re-inventing the wheel, when car
  you're infringing my copyright.  |  manufacturers are praised for it?
Technical Details
Message-ID: <10178@socslgw.csl.sony.JUNET>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!agate!bionet!ames!lll-winken!uunet!kddlab!ccut!titcca!sragwa!wsgw!socslgw!diamond!diamond
References: <5200040@m.cs.uiuc.edu> <12443@watdragon.waterloo.edu> <10162@socslgw.csl.sony.JUNET> <9382@dasys1.UUCP>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!agate!bionet!ames!lll-winken!uunet!kddlab!ccut!titcca!sragwa!wsgw!socslgw!diamond!diamond
From: diamond@diamond.csl.sony.junet (Norman Diamond)
Newsgroups: comp.lang.misc
Subject: Re: Language Design, or: is C's Grammar Context Free
Keywords: BNF, Grammars, Silliness
Message-ID: <10178@socslgw.csl.sony.JUNET>
Date: 20 Apr 89 12:42:00 GMT
References: <5200040@m.cs.uiuc.edu> <12443@watdragon.waterloo.edu> <10162@socslgw.csl.sony.JUNET> <9382@dasys1.UUCP>
Sender: news@csl.sony.JUNET
Reply-To: diamond@csl.sony.junet (Norman Diamond)
Organization: /usr/lib/news/organization
Lines: 48