crefman.doc 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629
  1. \." $Id$
  2. .\" eqn crefman.doc | troff -ms
  3. .EQ
  4. delim $$
  5. .EN
  6. .RP
  7. .TL
  8. ACK/CEM Compiler
  9. .br
  10. Reference Manual
  11. .AU
  12. Erik H. Baalbergen
  13. .AI
  14. Department of Mathematics and Computer Science
  15. Vrije Universiteit
  16. Amsterdam
  17. The Netherlands
  18. .AB no
  19. .AE
  20. .NH
  21. C Language
  22. .PP
  23. This section discusses the extensions to and deviations from the C language,
  24. as described in [1].
  25. The issues are numbered according to the reference manual.
  26. .SH
  27. 2.2 Identifiers
  28. .PP
  29. Upper and lower case letters are different.
  30. The number of significant letters
  31. is 32 by default, but may be set to another value using the \fB\-M\fP option.
  32. The identifier length should be set according to the rest of the compilation
  33. programs.
  34. .SH
  35. 2.3 Keywords
  36. .SH
  37. \f(CWasm\fP
  38. .PP
  39. The keyword \f(CWasm\fP
  40. is recognized.
  41. However, the statement
  42. .DS
  43. .ft CW
  44. asm(string);
  45. .ft R
  46. .DE
  47. is skipped, while a warning is given.
  48. .SH
  49. \f(CWenum\fP
  50. .PP
  51. The \f(CWenum\fP keyword is recognized and interpreted.
  52. .SH
  53. \f(CWentry\fP, \f(CWfortran\fP
  54. .PP
  55. The words \f(CWentry\fP and \f(CWfortran\fP
  56. are reserved under the restricted option.
  57. The words are not interpreted by the compiler.
  58. .SH
  59. 2.4.1 Integer Constants
  60. .PP
  61. The type of an integer constant is the first of the corresponding list
  62. in which its value can be represented. Decimal: \f(CWint, long, unsigned long\fP;
  63. octal or hexadecimal: \f(CWint, unsigned, long, unsigned long\fP; suffixed by
  64. the letter L or l: \f(CWlong, unsigned long\fP.
  65. .SH
  66. 2.4.3 Character Constants
  67. .PP
  68. A character constant is a sequence of 1 up to \f(CWsizeof(int)\fP characters
  69. enclosed in single quotes.
  70. The value of a character constant '$c sub 1 c sub 2 ... c sub n$'
  71. is $d sub n + M \(mu d sub {n - 1} + ... + M sup {n - 1} \(mu d sub 2 + M sup n \(mu d sub 1$,
  72. where M is 1 + maximum unsigned number representable in an \f(CWunsigned char\fP,
  73. and $d sub i$ is the signed value (ASCII)
  74. of character $c sub i$.
  75. .SH
  76. 2.4.4 Floating Constants
  77. .PP
  78. The compiler does not support compile-time floating point arithmetic.
  79. .SH
  80. 2.6 Hardware characteristics
  81. .PP
  82. The compiler is capable of producing EM code for machines with the following
  83. properties
  84. .IP \(bu
  85. a \f(CWchar\fP is 8 bits
  86. .IP \(bu
  87. the size of \f(CWint\fP is equal to the word size
  88. .IP \(bu
  89. the size of \f(CWshort\fP may not exceed the size of \f(CWint\fP
  90. .IP \(bu
  91. the size of \f(CWint\fP may not exceed the size of \f(CWlong\fP
  92. .IP \(bu
  93. the size of pointers is equal to the size of either \f(CWshort\fP, \f(CWint\fP
  94. or \f(CWlong\fP
  95. .LP
  96. .SH
  97. 4 What's in a name?
  98. .SH
  99. \f(CWchar\fP
  100. .PP
  101. Objects of type \f(CWchar\fP are taken to be signed.
  102. The combination \f(CWunsigned char\fP is legal.
  103. .SH
  104. \f(CWunsigned\fP
  105. .PP
  106. The type combinations \f(CWunsigned char\fP, \f(CWunsigned short\fP and
  107. \f(CWunsigned long\fP are supported.
  108. .SH
  109. \f(CWenum\fP
  110. .PP
  111. The data type \f(CWenum\fP is implemented as described
  112. in \fIRecent Changes to C\fP (see appendix A).
  113. .I Cem
  114. treats enumeration variables as if they were \f(CWint\fP.
  115. .SH
  116. \f(CWvoid\fP
  117. .PP
  118. Type \f(CWvoid\fP is implemented.
  119. The type specifies an empty set of values, which takes no storage space.
  120. .SH
  121. \fRFundamental types\fP
  122. .PP
  123. The names of the fundamental types can be redefined by the user, using
  124. \f(CWtypedef\fP.
  125. .SH
  126. 7 Expressions
  127. .PP
  128. The order of evaluation of expressions depends on the complexity of the
  129. subexpressions.
  130. In case of commutative operations, the most complex subexpression is
  131. evaluated first.
  132. Parameter lists are evaluated from right to left.
  133. .SH
  134. 7.2 Unary operators
  135. .PP
  136. The type of a \f(CWsizeof\fP expression is \f(CWunsigned int\fP.
  137. .SH
  138. 7.13 Conditional operator
  139. .PP
  140. Both the second and the third expression in a conditional expression may
  141. include assignment operators.
  142. They may be structs or unions.
  143. .SH
  144. 7.14 Assignment operators
  145. .PP
  146. Structures may be assigned, passed as arguments to functions, and returned
  147. by functions.
  148. The types of operands taking part must be the same.
  149. .SH
  150. 8.2 Type specifiers
  151. .PP
  152. The combinations \f(CWunsigned char\fP, \f(CWunsigned short\fP
  153. and \f(CWunsigned long\fP are implemented.
  154. .SH
  155. 8.5 Structure and union declarations
  156. .PP
  157. Fields of any integral type, either signed or unsigned,
  158. are supported, as long as the type fits in a word on the target machine.
  159. .PP
  160. Fields are left adjusted by default; the first field is put into the left
  161. part of a word, the next one on the right side of the first one, etc.
  162. The \f(CW-Vr\fP option in the call of the compiler
  163. causes fields to be right adjusted within a machine word.
  164. .PP
  165. The tags of structs and unions occupy a different name space from that of
  166. variables and that of member names.
  167. .SH
  168. 9.7 Switch statement
  169. .PP
  170. The type of \fIexpression\fP in
  171. .DS
  172. .ft CW
  173. \f(CWswitch (\fP\fIexpression\fP\f(CW)\fP \fIstatement\fP
  174. .ft
  175. .DE
  176. must be integral.
  177. A warning is given under the restricted option if the type is \f(CWlong\fP.
  178. .SH
  179. 10 External definitions
  180. .PP
  181. See [4] for a discussion on this complicated issue.
  182. .SH
  183. 10.1 External function definitions
  184. .PP
  185. Structures may be passed as arguments to functions, and returned
  186. by functions.
  187. .SH
  188. 11.1 Lexical scope
  189. .PP
  190. Typedef names may be redeclared like any other variable name; the ice mentioned
  191. in \(sc11.1 is walked correctly.
  192. .SH
  193. 12 Compiler control lines
  194. .PP
  195. Lines which do not occur within comment, and with \f(CW#\fP as first
  196. character, are interpreted as compiler control line.
  197. There may be an arbitrary number of spaces, tabs and comments (collectively
  198. referred as \fIwhite space\fP) following the \f(CW#\fP.
  199. Comments may contain newline characters.
  200. Control lines with only white space between the \f(CW#\fP and the line separator
  201. are skipped.
  202. .PP
  203. The #\f(CWinclude\fP, #\f(CWifdef\fP, #\f(CWifndef\fP, #\f(CWundef\fP, #\f(CWelse\fP and
  204. #\f(CWendif\fP control lines and line directives consist of a fixed number of
  205. arguments.
  206. The list of arguments may be followed an arbitrary sequence of characters,
  207. in which comment is interpreted as such.
  208. (I.e., the text between \f(CW/*\fP and \f(CW*/\fP is skipped, regardless of
  209. newlines; note that commented-out lines beginning with \f(CW#\fP are not
  210. considered to be control lines.)
  211. .SH
  212. 12.1 Token replacement
  213. .PP
  214. The replacement text of macros is taken to be a string of characters, in which
  215. an identifier may stand for a formal parameter, and in which comment is
  216. interpreted as such.
  217. Comments and newline characters, preceeded by a backslash, in the replacement
  218. text are replaced by a space character.
  219. .PP
  220. The actual parameters of a macro are considered tokens and are
  221. balanced with regard to \f(CW()\fP, \f(CW{}\fP and \f(CW[]\fP.
  222. This prevents the use of macros like
  223. .DS
  224. .ft CW
  225. CTL([)
  226. .ft
  227. .DE
  228. .PP
  229. Formal parameters of a macro must have unique names within the formal-parameter
  230. list of that macro.
  231. .PP
  232. A message is given at the definition of a macro if the macro has
  233. already been #\f(CWdefined\fP, while the number of formal parameters differ or
  234. the replacement texts are not equal (apart from leading and trailing
  235. white space).
  236. .PP
  237. Recursive use of macros is detected by the compiler.
  238. .PP
  239. Standard #\f(CWdefined\fP macros are
  240. .DS
  241. \f(CW__FILE__\fP name of current input file as string constant
  242. \f(CW__DATE__\fP curent date as string constant; e.g. \f(CW"Tue Wed 2 14:45:23 1986"\fP
  243. \f(CW__LINE__\fP current line number as an integer
  244. .DE
  245. .PP
  246. No message is given if \fIidentifier\fP is not known in
  247. .DS
  248. .ft CW
  249. #undef \fIidentifier\fP
  250. .ft
  251. .DE
  252. .SH
  253. 12.2 File inclusion
  254. .PP
  255. A newline character is appended to each file which is included.
  256. .SH
  257. 12.3 Conditional compilation
  258. .PP
  259. The #\f(CWif\fP, #\f(CWifdef\fP and #\f(CWifndef\fP control lines may be followed
  260. by an arbitrary number of
  261. .DS
  262. .ft CW
  263. #elif \fIconstant-expression\fP
  264. .ft
  265. .DE
  266. control lines, before the corresponding #\f(CWelse\fP or #\f(CWendif\fP
  267. is encountered.
  268. The construct
  269. .DS
  270. .ft CW
  271. #elif \fIconstant-expression\fP
  272. some text
  273. #endif /* corresponding to #elif */
  274. .ft
  275. .DE
  276. is equivalent to
  277. .DS
  278. .ft CW
  279. #else
  280. #if \fIconstant-expression\fP
  281. some text
  282. #endif /* corresponding to #if */
  283. #endif /* corresponding to #else */
  284. .ft
  285. .DE
  286. .PP
  287. The \fIconstant-expression\fP in #\f(CWif\fP and #\f(CWelif\fP control lines
  288. may contain the construction
  289. .DS
  290. .ft CW
  291. defined(\fIidentifier\fP)
  292. .ft
  293. .DE
  294. which is replaced by \f(CW1\fP, if \fIidentifier\fP has been #\f(CWdefined\fP,
  295. and by \f(CW0\fP, if not.
  296. .PP
  297. Comments in skipped lines are interpreted as such.
  298. .SH
  299. 12.4 Line control
  300. .PP
  301. Line directives may occur in the following forms:
  302. .DS
  303. .ft CW
  304. #line \fIconstant\fP
  305. #line \fIconstant\fP "\fIfilename\fP"
  306. #\fIconstant\fP
  307. #\fIconstant\fP "\fIfilename\fP"
  308. .ft
  309. .DE
  310. Note that \fIfilename\fP is enclosed in double quotes.
  311. .SH
  312. 14.2 Functions
  313. .PP
  314. If a pointer to a function is called, the function the pointer points to
  315. is called instead.
  316. .SH
  317. 15 Constant expressions
  318. .PP
  319. The compiler distinguishes the following types of integral constant expressions
  320. .IP \(bu
  321. field-width specifier
  322. .IP \(bu
  323. case-entry specifier
  324. .IP \(bu
  325. array-size specifier
  326. .IP \(bu
  327. global variable initialization value
  328. .IP \(bu
  329. enum-value specifier
  330. .IP \(bu
  331. truth value in \f(CW#if\fP control line
  332. .LP
  333. .PP
  334. Constant integral expressions are compile-time evaluated while an effort
  335. is made to report overflow.
  336. Constant floating expressions are not compile-time evaluated.
  337. .NH
  338. Compiler flags
  339. .IP \fB\-C\fR
  340. Run the preprocessor stand-alone while maintaining the comments.
  341. Line directives are produced whenever needed.
  342. .IP \fB\-D\fP\fIname\fP=\fIstring-of-characters\fP
  343. .br
  344. Define \fIname\fR as macro with \fIstring-of-characters\fR as
  345. replacement text.
  346. .IP \fB\-D\fP\fIname\fP
  347. .br
  348. Equal to \fB\-D\fP\fIname\fP\fB=1\fP.
  349. .IP \fB\-E\fP
  350. Run the preprocessor stand alone, i.e.,
  351. list the sequence of input tokens and delete any comments.
  352. Line directives are produced whenever needed.
  353. .IP \fB\-I\fIpath\fR
  354. .br
  355. Prepend \fIpath\fR to the list of include directories.
  356. To put the directories "include", "sys/h" and "util/h" into the
  357. include directory list in that order, the user has to specify
  358. .DS
  359. .ft CW
  360. -Iinclude -Isys/h -Iutil/h
  361. .ft R
  362. .DE
  363. An empty \fIpath\fP causes the standard include
  364. directory (usually \f(CW/usr/include\fP) to be forgotten.
  365. .IP \fB\-M\fP\fIn\fP
  366. .br
  367. Set maximum significant identifier length to \fIn\fP.
  368. .IP \fB\-n\fP
  369. Suppress EM register messages.
  370. The user-declared variables are not stored into registers on the target
  371. machine.
  372. .IP \fB\-p\fP
  373. Generate the EM \fBfil\fP and \fBlin\fP instructions in order to enable
  374. an interpreter to keep track of the current location in the source code.
  375. .IP \fB\-P\fP
  376. Equivalent with \fB\-E\fP, but without line directives.
  377. .IP \fB\-R\fP
  378. Interpret the input as restricted C (according to the language as
  379. described in [1]).
  380. .IP \fB\-T\fP\fIpath\fP
  381. .br
  382. Create temporary files, if necessary, in directory \fIpath\fP.
  383. .IP \fB\-U\fP\fIname\fP
  384. .br
  385. Get rid of the compiler-predefined macro \fIname\fP, i.e.,
  386. consider
  387. .DS
  388. .ft CW
  389. #undef \fIname\fP
  390. .ft R
  391. .DE
  392. to appear in the beginning of the file.
  393. .IP \fB\-V\fIcm\fR.\fIn\fR,\ \fB\-V\fIcm\fR.\fIncm\fR.\fIn\fR\ ...
  394. .br
  395. Set the size and alignment requirements.
  396. The letter \fIc\fR indicates the simple type, which is one of
  397. \fBs\fR(short), \fBi\fR(int), \fBl\fR(long), \fBf\fR(float), \fBd\fR(double)
  398. or \fBp\fR(pointer).
  399. If \fIc\fR is \fBS\fP or \fBU\fP, then \fIn\fP is taken to be the initial
  400. alignment of structs or unions, respectively.
  401. The effective alignment of a struct or union is the least common multiple
  402. of the initial struct/union alignment and the alignments of its members.
  403. The \fIm\fR parameter can be used to specify the length of the type (in bytes)
  404. and the \fIn\fR parameter for the alignment of that type.
  405. Absence of \fIm\fR or \fIn\fR causes the default value to be retained.
  406. To specify that the bitfields should be right adjusted instead of the
  407. default left adjustment, specify \fBr\fR as \fIc\fR parameter.
  408. .IP \fB\-w\fR
  409. Suppress warning messages
  410. .IP \fB\-\-\fIcharacter\fR
  411. .br
  412. Set debug-flag \fIcharacter\fP.
  413. This enables some special features offered by a debug and develop version of
  414. the compiler.
  415. Some particular flags may be recognized, others may have surprising effects.
  416. .RS
  417. .IP \fBd\fP
  418. Generate a dependency graph, reflecting the calling structure of functions.
  419. Lines of the form
  420. .DS
  421. .ft CW
  422. DFA: \fIcalling-function\fP: \fIcalled-function\fP
  423. .ft
  424. .DE
  425. are generated whenever a function call is encountered.
  426. .IP \fBf\fP
  427. Dump whole identifier table, including macros and reserved words.
  428. .IP \fBh\fP
  429. Supply hash-table statistics.
  430. .IP \fBi\fP
  431. Print names of included files.
  432. .IP \fBm\fP
  433. Supply statistics concerning the memory allocation.
  434. .IP \fBt\fP
  435. Dump table of identifiers.
  436. .IP \fBu\fP
  437. Generate extra statistics concerning the predefined types and identifiers.
  438. Works in combination with \fBf\fP or \fBt\fP.
  439. .IP \fBx\fP
  440. Print expression trees in human-readable format.
  441. .RE
  442. .LP
  443. .SH
  444. References
  445. .IP [1]
  446. Brian W. Kernighan, Dennis M. Ritchie,
  447. .I
  448. The C Programming Language
  449. .R
  450. .IP [2]
  451. L. Rosler,
  452. .I
  453. Draft Proposed Standard - Programming Language C,
  454. .R
  455. ANSI X3J11 Language Subcommittee
  456. .IP [3]
  457. Erik H. Baalbergen, Dick Grune, Maarten Waage,
  458. .I
  459. The CEM Compiler,
  460. .R
  461. Informatica Manual IM-4, Dept. of Mathematics and Computer Science, Vrije
  462. Universiteit, Amsterdam, The Netherlands
  463. .IP [4]
  464. Erik H. Baalbergen,
  465. .I
  466. Modeling global declarations in C,
  467. .R
  468. internal paper
  469. .LP
  470. .bp
  471. .SH
  472. Appendix A - Enumeration Type
  473. .PP
  474. The syntax is
  475. .sp
  476. .RS
  477. .I enum-specifier :
  478. .RS
  479. \&\f(CWenum\fP { \fIenum-list\fP }
  480. .br
  481. \&\f(CWenum\fP \fIidentifier\fP { \fIenum-list\fP }
  482. .br
  483. \&\f(CWenum\fP \fIidentifier\fP
  484. .RE
  485. .sp
  486. \&\fIenum-list\fP :
  487. .RS
  488. \&\fIenumerator\fP
  489. .br
  490. \&\fIenum-list\fP , \fIenumerator\fP
  491. .RE
  492. .sp
  493. \&\fIenumerator\fP :
  494. .RS
  495. \&\fIidentifier\fP
  496. .br
  497. \&\fIidentifier\fP = \fIconstant-expression\fP
  498. .RE
  499. .sp
  500. .RE
  501. The identifier has the same role as the structure tag in a struct specification.
  502. It names a particular enumeration type.
  503. .PP
  504. The identifiers in the enum-list are declared as constants, and may appear
  505. whenever constants are required.
  506. If no enumerators with
  507. .B =
  508. appear, then the values of the constants begin at 0 and increase by 1 as the
  509. declaration is read from left to right.
  510. An enumerator with
  511. .B =
  512. gives the associated identifier the value indicated; subsequent identifiers
  513. continue the progression from the assigned value.
  514. .PP
  515. Enumeration tags and constants must all be distinct, and, unlike structure
  516. tags and members, are drawn from the same set as ordinary identifiers.
  517. .PP
  518. Objects of a given enumeration type are regarded as having a type distinct
  519. from objects of all other types.
  520. .bp
  521. .SH
  522. Appendix B: C grammar in LL(1) form
  523. .PP
  524. The \fBbold-faced\fP and \fIitalicized\fP tokens represent terminal symbols.
  525. .vs 16
  526. .nf
  527. \fBexternal definitions\fP
  528. program: external-definition*
  529. external-definition: ext-decl-specifiers [declarator [function | non-function] | '\fB;\fP'] | asm-statement
  530. ext-decl-specifiers: decl-specifiers?
  531. non-function: initializer? ['\fB,\fP' init-declarator]* '\fB;\fP'
  532. function: declaration* compound-statement
  533. .sp 1
  534. \fBdeclarations\fP
  535. declaration: decl-specifiers init-declarator-list? '\fB;\fP'
  536. decl-specifiers: other-specifier+ [single-type-specifier other-specifier*]? | single-type-specifier other-specifier*
  537. other-specifier: \fBauto\fP | \fBstatic\fP | \fBextern\fP | \fBtypedef\fP | \fBregister\fP | \fBshort\fP | \fBlong\fP | \fBunsigned\fP
  538. type-specifier: decl-specifiers
  539. single-type-specifier: \fItype-identifier\fP | struct-or-union-specifier | enum-specifier
  540. init-declarator-list: init-declarator ['\fB,\fP' init-declarator]*
  541. init-declarator: declarator initializer?
  542. declarator: primary-declarator ['\fB(\fP' formal-list ? '\fB)\fP' | arrayer]* | '\fB*\fP' declarator
  543. primary-declarator: identifier | '\fB(\fP' declarator '\fB)\fP'
  544. arrayer: '\fB[\fP' constant-expression? '\fB]\fP'
  545. formal-list: formal ['\fB,\fP' formal]*
  546. formal: identifier
  547. enum-specifier: \fBenum\fP [enumerator-pack | identifier enumerator-pack?]
  548. enumerator-pack: '\fB{\fP' enumerator ['\fB,\fP' enumerator]* '\fB,\fP'? '\fB}\fP'
  549. enumerator: identifier ['\fB=\fP' constant-expression]?
  550. struct-or-union-specifier: [ \fBstruct\fP | \fBunion\fP] [ struct-declaration-pack | identifier struct-declaration-pack?]
  551. struct-declaration-pack: '\fB{\fP' struct-declaration+ '\fB}\fP'
  552. struct-declaration: type-specifier struct-declarator-list '\fB;\fP'?
  553. struct-declarator-list: struct-declarator ['\fB,\fP' struct-declarator]*
  554. struct-declarator: declarator bit-expression? | bit-expression
  555. bit-expression: '\fB:\fP' constant-expression
  556. initializer: '\fB=\fP'? initial-value
  557. cast: '\fB(\fP' type-specifier abstract-declarator '\fB)\fP'
  558. abstract-declarator: primary-abstract-declarator ['\fB(\fP' '\fB)\fP' | arrayer]* | '\fB*\fP' abstract-declarator
  559. primary-abstract-declarator: ['\fB(\fP' abstract-declarator '\fB)\fP']?
  560. .sp 1
  561. \fBstatements\fP
  562. statement:
  563. expression-statement
  564. | label '\fB:\fP' statement
  565. | compound-statement
  566. | if-statement
  567. | while-statement
  568. | do-statement
  569. | for-statement
  570. | switch-statement
  571. | case-statement
  572. | default-statement
  573. | break-statement
  574. | continue-statement
  575. | return-statement
  576. | jump
  577. | '\fB;\fP'
  578. | asm-statement
  579. ;
  580. expression-statement: expression '\fB;\fP'
  581. label: identifier
  582. if-statement: \fBif\fP '\fB(\fP' expression '\fB)\fP' statement [\fBelse\fP statement]?
  583. while-statement: \fBwhile\fP '\fB(\fP' expression '\fB)\fP' statement
  584. do-statement: \fBdo\fP statement \fBwhile\fP '\fB(\fP' expression '\fB)\fP' '\fB;\fP'
  585. for-statement: \fBfor\fP '\fB(\fP' expression? '\fB;\fP' expression? '\fB;\fP' expression? '\fB)\fP' statement
  586. switch-statement: \fBswitch\fP '\fB(\fP' expression '\fB)\fP' statement
  587. case-statement: \fBcase\fP constant-expression '\fB:\fP' statement
  588. default-statement: \fBdefault\fP '\fB:\fP' statement
  589. break-statement: \fBbreak\fP '\fB;\fP'
  590. continue-statement: \fBcontinue\fP '\fB;\fP'
  591. return-statement: \fBreturn\fP expression? '\fB;\fP'
  592. jump: \fBgoto\fP identifier '\fB;\fP'
  593. compound-statement: '\fB{\fP' declaration* statement* '\fB}\fP'
  594. asm-statement: \fBasm\fP '\fB(\fP' \fIstring\fP '\fB)\fP' '\fB;\fP'
  595. .sp 1
  596. \fBexpressions\fP
  597. initial-value: assignment-expression | initial-value-pack
  598. initial-value-pack: '\fB{\fP' initial-value-list '\fB}\fP'
  599. initial-value-list: initial-value ['\fB,\fP' initial-value]* '\fB,\fP'?
  600. primary: \fIidentifier\fP | constant | \fIstring\fP | '\fB(\fP' expression '\fB)\fP'
  601. secundary: primary [index-pack | parameter-pack | selection]*
  602. index-pack: '\fB[\fP' expression '\fB]\fP'
  603. parameter-pack: '\fB(\fP' parameter-list? '\fB)\fP'
  604. selection: ['\fB.\fP' | '\fB\->\fP'] identifier
  605. parameter-list: assignment-expression ['\fB,\fP' assignment-expression]*
  606. postfixed: secundary postop?
  607. unary: cast unary | postfixed | unop unary | size-of
  608. size-of: \fBsizeof\fP [cast | unary]
  609. binary-expression: unary [binop binary-expression]*
  610. conditional-expression: binary-expression ['\fB?\fP' expression '\fB:\fP' assignment-expression]?
  611. assignment-expression: conditional-expression [asgnop assignment-expression]?
  612. expression: assignment-expression ['\fB,\fP' assignment-expression]*
  613. unop: '\fB*\fP' | '\fB&\fP' | '\fB\-\fP' | '\fB!\fP' | '\fB~ \fP' | '\fB++\fP' | '\fB\-\-\fP'
  614. postop: '\fB++\fP' | '\fB\-\-\fP'
  615. multop: '\fB*\fP' | '\fB/\fP' | '\fB%\fP'
  616. addop: '\fB+\fP' | '\fB\-\fP'
  617. shiftop: '\fB<<\fP' | '\fB>>\fP'
  618. relop: '\fB<\fP' | '\fB>\fP' | '\fB<=\fP' | '\fB>=\fP'
  619. eqop: '\fB==\fP' | '\fB!=\fP'
  620. arithop: multop | addop | shiftop | '\fB&\fP' | '\fB^ \fP' | '\fB|\fP'
  621. binop: arithop | relop | eqop | '\fB&&\fP' | '\fB||\fP'
  622. asgnop: '\fB=\fP' | '\fB+\fP' '\fB=\fP' | '\fB\-\fP' '\fB=\fP' | '\fB*\fP' '\fB=\fP' | '\fB/\fP' '\fB=\fP' | '\fB%\fP' '\fB=\fP'
  623. | '\fB<<\fP' '\fB=\fP' | '\fB>>\fP' '\fB=\fP' | '\fB&\fP' '\fB=\fP' | '\fB^ \fP' '\fB=\fP' | '\fB|\fP' '\fB=\fP'
  624. | '\fB+=\fP' | '\fB\-=\fP' | '\fB*=\fP' | '\fB/=\fP' | '\fB%=\fP'
  625. | '\fB<<=\fP' | '\fB>>=\fP' | '\fB&=\fP' | '\fB^=\fP' | '\fB|=\fP'
  626. constant: \fIinteger\fP | \fIfloating\fP
  627. constant-expression: assignment-expression
  628. identifier: \fIidentifier\fP | \fItype-identifier\fP
  629. .fi