Release 3.3 Copyright ©1995 by NeXT Computer, Inc. All Rights Reserved.
Reference Manual for the Objective C Language
|This appendix presents a formal grammar for the Objective C extensions to the C language--as the Objective C language is implemented for the NEXTSTEP development environment. It adds to the grammar for ANSI standard C found in Appendix A of The C Programming Language (second edition, 1988) by Brian W. Kernighan and Dennis M. Ritchie, published by Prentice Hall, and should be read in conjunction with that book.
The Objective C extensions introduce some new symbols (such as class-interface), but also make use of symbols (such as function-definition) that are explained in the standard C grammar. The symbols mentioned but not explained here are listed below:
|Of these, identifier and string are undefined terminal symbols. Objective C adds no undefined terminal symbols of its own.
Two notational conventions used here differ from those used in The C Programming Language:
|Literal symbols are shown in bold type.|
|Brackets enclose optional elements and are in italic type. Literal brackets, like other literal symbols, are nonitalic and bold.|
|Otherwise, this appendix follows the conventions of the C reference manual. Each part of the grammar consists of a symbol followed by a colon and an indented list of mutually-exclusive possibilities for expanding the symbol. For example:|
|However, there is an exception: Even though they're not mutually exclusive, the constituents of classes, categories, and protocols are listed on separate lines to clearly show the ordering of elements. For example:|
[ protocol-reference-list ]
[ interface-declaration-list ]
|This exception to the general rule is easily recognized since each list terminates with @end.
There are just four entry points where the Objective C language modifies the rules defined for standard C:
|This appendix is therefore divided into four sections corresponding to these points. Where a rule in the standard C grammar is modified by an Objective C extension, the entire rule is repeated in its modified form.|
id [ protocol-reference-list ]
class-name [ protocol-reference-list ]
( expression )