Path: utzoo!dptcdc!jarvis.csri.toronto.edu!mailrus!iuvax!rutgers!cmcl2!phri!cooper!dasys1!aj-mberg From: aj-mberg@dasys1.UUCP (Micha Berger) Newsgroups: comp.lang.misc Subject: Re: Language Design, or: is C's Grammar Context Free Summary: Functios Keywords: BNF, Grammars, Silliness Message-ID: <9382@dasys1.UUCP> Date: 18 Apr 89 14:51:39 GMT References: <5200040@m.cs.uiuc.edu> <12443@watdragon.waterloo.edu> <10162@socslgw.csl.sony.JUNET> Organization: The Big Electric Cat Lines: 43 In article <10162@socslgw.csl.sony.JUNET>, diamond@diamond.csl.sony.junet (Norman Diamond) writes: > In article <9313@dasys1.UUCP> aj-mberg@dasys1.UUCP (Micha Berger) writes: > >> Consider the following in C, however: > > > >> . . . { T (x); . . . } > > > >> How should the construct be parsed? > > > >It would have to be an expression, since anything within brackets ain't a > >decleration. This isn't Pascal kiddees, all functions are global. > > Anything within brackets is a declaration until the end of > the declarations, and then statements (expressions) until the closing > bracket. This isn't Pascal kiddee; intuition and aesthetics are not > welcome here. 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. 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; { }; . . . } and that's what I meant about being allowed in Pascal and not in C. (BTW I've been using C as my primary language since 1978 not because C is superior as a language, just that it gives me more power to optimize my code. If I got a Pascal with a good enough optimizer, I'd switch back. I like C's speed, not the language itself.) -- Micha Berger Disclaimer: All opinions expressed here are my own. The spelling, noone's. email: ...!cmcl2!hombre!dasys1!aj-mberg Aspaklaria Publications vox: (718) 380-7572 73-32 173 St, Hillcrest, NY 11366