10 extern struct obstack ast_obstack;
34 declaration_t *declarations;
38 expresion_type_t type;
40 source_position_t source_position;
44 expression_t expression;
47 long double float_value;
51 struct string_literal_t {
52 expression_t expression;
56 struct builtin_symbol_expression_t {
57 expression_t expression;
61 struct reference_expression_t {
62 expression_t expression;
64 declaration_t *declaration;
67 struct call_argument_t {
68 expression_t *expression;
69 call_argument_t *next;
72 struct call_expression_t {
73 expression_t expression;
75 call_argument_t *arguments;
82 UNEXPR_BITWISE_NEGATE,
86 UNEXPR_POSTFIX_INCREMENT,
87 UNEXPR_POSTFIX_DECREMENT,
88 UNEXPR_PREFIX_INCREMENT,
89 UNEXPR_PREFIX_DECREMENT,
91 } unary_expression_type_t;
93 struct unary_expression_t {
94 expression_t expression;
95 unary_expression_type_t type;
111 BINEXPR_GREATEREQUAL,
125 BINEXPR_SHIFTLEFT_ASSIGN,
126 BINEXPR_SHIFTRIGHT_ASSIGN,
127 BINEXPR_BITWISE_AND_ASSIGN,
128 BINEXPR_BITWISE_XOR_ASSIGN,
129 BINEXPR_BITWISE_OR_ASSIGN,
131 } binary_expression_type_t;
133 struct binary_expression_t {
134 expression_t expression;
135 binary_expression_type_t type;
140 struct select_expression_t {
141 expression_t expression;
142 expression_t *compound;
145 declaration_t *compound_entry;
148 struct array_access_expression_t {
149 expression_t expression;
150 expression_t *array_ref;
154 struct sizeof_expression_t {
155 expression_t expression;
157 expression_t *size_expression;
160 struct designator_t {
162 expression_t *array_access;
166 struct offsetof_expression_t {
167 expression_t expression;
169 designator_t *designator;
172 struct va_arg_expression_t {
173 expression_t expression;
178 struct conditional_expression_t {
179 expression_t expression;
180 expression_t *condition;
181 expression_t *true_expression;
182 expression_t *false_expression;
185 struct statement_expression_t {
186 expression_t expression;
187 statement_t *statement;
192 STORAGE_CLASS_TYPEDEF,
193 STORAGE_CLASS_EXTERN,
194 STORAGE_CLASS_STATIC,
196 STORAGE_CLASS_REGISTER,
197 STORAGE_CLASS_ENUM_ENTRY
210 } initializer_type_t;
212 struct initializer_t {
213 initializer_type_t type;
214 designator_t *designator;
222 struct declaration_t {
223 unsigned short namespace;
224 unsigned short storage_class;
227 source_position_t source_position;
230 statement_t *statement;
231 initializer_t *initializer;
234 context_t *parent_context;
236 /** next declaration in a context */
237 declaration_t *context_next;
238 /** next declaration with same symbol */
246 STATEMENT_DECLARATION,
249 STATEMENT_EXPRESSION,
254 STATEMENT_CASE_LABEL,
261 statement_type_t type;
263 source_position_t source_position;
266 struct return_statement_t {
267 statement_t statement;
268 expression_t *return_value;
271 struct compound_statement_t {
272 statement_t statement;
273 statement_t *statements;
277 struct declaration_statement_t {
278 statement_t statement;
279 declaration_t *declarations_begin;
280 declaration_t *declarations_end;
282 int value_number; /**< filled in by semantic phase */
286 struct if_statement_t {
287 statement_t statement;
288 expression_t *condition;
289 statement_t *true_statement;
290 statement_t *false_statement;
293 struct switch_statement_t {
294 statement_t statement;
295 expression_t *expression;
299 struct goto_statement_t {
300 statement_t statement;
301 symbol_t *label_symbol;
302 label_statement_t *label;
305 struct case_label_statement_t {
306 statement_t statement;
307 expression_t *expression;
310 struct label_statement_t {
311 statement_t statement;
315 struct expression_statement_t {
316 statement_t statement;
317 expression_t *expression;
320 struct while_statement_t {
321 statement_t statement;
322 expression_t *condition;
326 struct do_while_statement_t {
327 statement_t statement;
328 expression_t *condition;
332 struct for_statement_t {
333 statement_t statement;
334 expression_t *initialisation;
335 expression_t *condition;
341 struct translation_unit_t {
346 void *_allocate_ast(size_t size)
348 return obstack_alloc(&ast_obstack, size);
351 #define allocate_ast(size) _allocate_ast(size)