Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 314 lines (244 sloc) 7.964 kb
05eedb5 Todd Ditchendorf initial add
authored
1 translation-unit:
2 external-declaration
3 translation-unit external-declaration
4
5 external-declaration:
6 function-definition
7 declaration
8
9 function-definition:
10 declaration-specifiersopt declarator declaration-listopt compound-statement
11
12 declaration:
13 declaration-specifiers init-declarator-listopt;
14
15 declaration-list:
16 declaration
17 declaration-list declaration
18
19 declaration-specifiers:
20 storage-class-specifier declaration-specifiersopt
21 type-specifier declaration-specifiersopt
22 type-qualifier declaration-specifiersopt
23
24 storage-class specifier: one of
25 auto register static extern typedef
26
27 type specifier: one of
28 void char short int long float double signed
29 unsigned struct-or-union-specifier enum-specifier typedef-name
30
31 type-qualifier: one of
32 const volatile
33
34 struct-or-union-specifier:
35 struct-or-union identifieropt { struct-declaration-list }
36 struct-or-union identifier
37
38 struct-or-union: one of
39 struct union
40
41 struct-declaration-list:
42 struct declaration
43 struct-declaration-list struct declaration
44
45 init-declarator-list:
46 init-declarator
47 init-declarator-list, init-declarator
48
49 init-declarator:
50 declarator
51 declarator = initializer
52
53 struct-declaration:
54 specifier-qualifier-list struct-declarator-list;
55
56 specifier-qualifier-list:
57 type-specifier specifier-qualifier-listopt
58 type-qualifier specifier-qualifier-listopt
59
60 struct-declarator-list:
61 struct-declarator
62 struct-declarator-list , struct-declarator
63
64 struct-declarator:
65 declarator
66 declaratoropt : constant-expression
67
68 enum-specifier:
69 enum identifieropt { enumerator-list }
70 enum identifier
71
72 enumerator-list:
73 enumerator
74 enumerator-list , enumerator
75
76 enumerator:
77 identifier
78 identifier = constant-expression
79
80 declarator:
81 pointeropt direct-declarator
82
83 direct-declarator:
84 identifier
85 (declarator)
86 direct-declarator [ constant-expressionopt ]
87 direct-declarator ( parameter-type-list )
88 direct-declarator ( identifier-listopt )
89
90 pointer:
91 * type-qualifier-listopt
92 * type-qualifier-listopt pointer
93
94 type-qualifier-list:
95 type-qualifier
96 type-qualifier-list type-qualifier
97
98 parameter-type-list:
99 parameter-list
100 parameter-list , ...
101
102 parameter-list:
103 parameter-declaration
104 parameter-list , parameter-declaration
105
106 parameter-declaration:
107 declaration-specifiers declarator
108 declaration-specifiers abstract-declaratoropt
109
110 identifier-list:
111 identifier
112 identifier-list , identifier
113
114 initializer:
115 assignment-expression
116 { initializer-list }
117 { initializer-list , }
118
119 initializer-list:
120 initializer
121 initializer-list , initializer
122
123 type-name:
124 specifier-qualifier-list abstract-declaratoropt
125
126 abstract-declarator:
127 pointer
128 pointeropt direct-abstract-declarator
129
130 direct-abstract-declarator:
131 ( abstract-declarator )
132 direct-abstract-declaratoropt [constant-expressionopt]
133 direct-abstract-declaratoropt (parameter-type-listopt)
134
135 typedef-name:
136 identifier
137
138 statement:
139 labeled-statement
140 expression-statement
141 compound-statement
142 selection-statement
143 iteration-statement
144 jump-statement
145
146 labeled-statement:
147 identifier : statement
148 case constant-expression : statement
149 default : statement
150
151 expression-statement:
152 expressionopt;
153
154 compound-statement:
155 { declaration-listopt statement-listopt }
156
157 statement-list:
158 statement
159 statement-list statement
160
161 selection-statement:
162 if (expression) statement
163 if (expression) statement else statement
164 switch (expression) statement
165
166 iteration-statement:
167 while (expression) statement
168 do statement while (expression);
169 for (expressionopt; expressionopt; expressionopt) statement
170
171 jump-statement:
172 goto identifier;
173 continue;
174 break;
175 return expressionopt;
176
177 expression:
178 assignment-expression
179 expression , assignment-expression
180
181 assignment-expression:
182 conditional-expression
183 unary-expression assignment-operator assignment-expression
184
185 assignment-operator: one of
186 = *= /= %= += -= <<= >>= &= ^= |=
187
188 conditional-expression:
189 logical-OR-expression
190 logical-OR-expression ? expression : conditional-expression
191
192 constant-expression:
193 conditional-expression
194
195 logical-OR-expression:
196 logical-AND-expression
197 logical-OR-expression || logical-AND-expression
198
199 logical-AND-expression:
200 inclusive-OR-expression
201 logical-AND-expression && inclusive-OR-expression
202
203 inclusive-OR-expression:
204 exclusive-OR-expression
205 inclusive-OR-expression | exclusive-OR-expression
206
207 exclusive-OR-expression:
208 AND-expression
209 exclusive-OR-expression ^ AND-expression
210
211 AND-expression:
212 equality-expression
213 AND-expression & equality-expression
214
215 equality-expression:
216 relational-expression
217 equality-expression == relational-expression
218 equality-expression != relational-expression
219
220 relational-expression:
221 shift-expression
222 relational-expression < shift-expression
223 relational-expression > shift-expression
224 relational-expression <= shift-expression
225 relational-expression >= shift-expression
226
227 shift-expression:
228 additive-expression
229 shift-expression << additive-expression
230 shift-expression >> additive-expression
231
232 additive-expression:
233 multiplicative-expression
234 additive-expression + multiplicative-expression
235 additive-expression - multiplicative-expression
236
237 multiplicative-expression:
238 multiplicative-expression * cast-expression
239 multiplicative-expression / cast-expression
240 multiplicative-expression % cast-expression
241
242 cast-expression:
243 unary expression
244 (type-name) cast-expression
245
246 unary-expression:
247 postfix expression
248 ++unary expression
249 --unary expression
250 unary-operator cast-expression
251 sizeof unary-expression
252 sizeof (type-name)
253
254 unary operator: one of
255 & * + - ~ !
256
257 postfix-expression:
258 primary-expression
259 postfix-expression[expression]
260 postfix-expression(argument-expression-listopt)
261 postfix-expression.identifier
262 postfix-expression->+identifier
263 postfix-expression++
264 postfix-expression--
265 primary-expression:
266 identifier
267 constant
268 string
269 (expression)
270
271 argument-expression-list:
272 assignment-expression
273 assignment-expression-list , assignment-expression
274
275 constant:
276 integer-constant
277 character-constant
278 floating-constant
279 enumeration-constant
280
281 # The following grammar for the preprocessor summarizes the structure of control lines, but is not suitable for mechanized parsing. It includes the symbol text, which means ordinary program text, non-conditional preprocessor control lines, or complete preprocessor conditional instructions.
282
283 control-line:
284 # define identifier token-sequence
285 # define identifier(identifier, ... , identifier) token-sequence
286 # undef identifier
287 # include <filename>
288 # include "filename"
289 # line constant "filename"
290 # line constant
291 # error token-sequenceopt
292 # pragma token-sequenceopt
293 #
294 preprocessor-conditional
295
296 preprocessor-conditional:
297 if-line text elif-parts else-partopt #endif
298
299 if-line:
300 # if constant-expression
301 # ifdef identifier
302 # ifndef identifier
303
304 elif-parts:
305 elif-line text
306 elif-partsopt
307
308 elif-line:
309 # elif constant-expression
310
311 else-part:
312 else-line text
313 else-line:
314 #else
Something went wrong with that request. Please try again.