🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.misc
Article #6377

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

#6377
From: Rahul Dhesi
Date: Wed, 05 Apr 1989 16:41
24 lines
1602 bytes
In article <913@m10ux.ATT.COM> mnc@m10ux.ATT.COM (Michael Condict) writes:
>Consider the following in C, however:
>
>	. . . { T (x); . . . }
>
>How should the construct be parsed?

The parsing is always the same, from the point of view of a
context-free grammer.  It's the semantics that are different.  That you
assign a different meaning to the language construct based on what has
come before has nothing to do with its context-free grammar.

Context-free grammars don't care about the declaration of type names.
If they could, they wouldn't be context-free.

The confusion here arises because real languages like Pascal and C
simply *cannot* be completely defined using context-free grammars.  But
they are--because the definition we use is incomplete, and we fill in
the missing parts with a set of additional rules that are not part of
the context-free grammar.  The size of this set of rules may or may not
be greater for C than for Pascal.
-- 
Rahul Dhesi         UUCP:  <backbones>!{iuvax,pur-ee}!bsu-cs!dhesi
                    ARPA:  dhesi@bsu-cs.bsu.edu
Technical Details
Message-ID: <6541@bsu-cs.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!iuvax!bsu-cs!dhesi
References: <5200040@m.cs.uiuc.edu> <12443@watdragon.waterloo.edu> <16559@mimsy.UUCP> <913@m10ux.ATT.COM>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!iuvax!bsu-cs!dhesi
From: dhesi@bsu-cs.UUCP (Rahul Dhesi)
Newsgroups: comp.lang.misc
Subject: Re: Language Design, or: is C's Grammar Context Free
Keywords: BNF, Grammars, Silliness
Message-ID: <6541@bsu-cs.UUCP>
Date: 5 Apr 89 16:41:06 GMT
References: <5200040@m.cs.uiuc.edu> <12443@watdragon.waterloo.edu> <16559@mimsy.UUCP> <913@m10ux.ATT.COM>
Reply-To: dhesi@bsu-cs.UUCP (Rahul Dhesi)
Organization: CS Dept, Ball St U, Muncie, Indiana
Lines: 24