Article View: comp.lang.misc
Article #6356Re: Language Design
From: Norman Graham
Date: Fri, 24 Mar 1989 22:58
Date: Fri, 24 Mar 1989 22:58
25 lines
1567 bytes
1567 bytes
From article <9861@megaron.arizona.edu>, by gudeman@arizona.edu (David Gudeman):
> [stuff deleted about how the grammar specifies that
> any identifier can serve as a type-specifier]
>
> So both claims made in this argument are correct:
>
> (1) the grammar of C is not context free
> and
> (2) the grammar given in K&R is context free
This is an interesting point (ie. one I hadn't thought of before :-).
In theory, a grammar is a generator for strings in a language, not
a recognizer for a language (eg. various forms of automata). So
the grammar in K&R is context-free, but it doesn't generate the C
language--in addition to valid C programs it also generates invalid
C programs. Of course, when this grammar is used as the basis of
a compiler, the semantic analyzer should detect these invalid
programs. This makes sense to me... how about anyone else out there?
--
Norman Graham Oklahoma State University
Internet: norman@a.cs.okstate.edu Computing and Information Sciences
UUCP: {cbosgd, ihnp4, 219 Mathematical Sciences Building
rutgers}!okstate!norman Stillwater, OK 74078-0599
Technical Details
Message-ID:
<4526@okstate.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!ucsd!rutgers!okstate!normanReferences:
<9861@megaron.arizona.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!ucsd!rutgers!okstate!norman From: norman@a.cs.okstate.edu (Norman Graham) Newsgroups: comp.lang.misc Subject: Re: Language Design Message-ID: <4526@okstate.UUCP> Date: 24 Mar 89 22:58:42 GMT References: <9861@megaron.arizona.edu> Organization: Oklahoma State Univ., Stillwater Lines: 25