10 extern struct obstack ast_obstack;
30 declaration_t *declarations;
31 compound_type_t *structs;
32 compound_type_t *unions;
37 expresion_type_t type;
39 source_position_t source_position;
43 expression_t expression;
47 struct string_literal_t {
48 expression_t expression;
52 struct reference_expression_t {
53 expression_t expression;
55 declaration_t *declaration;
58 struct call_argument_t {
59 expression_t *expression;
60 call_argument_t *next;
63 struct call_expression_t {
64 expression_t expression;
66 call_argument_t *arguments;
73 UNEXPR_BITWISE_NEGATE,
77 UNEXPR_POSTFIX_INCREMENT,
78 UNEXPR_POSTFIX_DECREMENT,
79 UNEXPR_PREFIX_INCREMENT,
80 UNEXPR_PREFIX_DECREMENT,
82 } unary_expression_type_t;
84 struct unary_expression_t {
85 expression_t expression;
86 unary_expression_type_t type;
102 BINEXPR_GREATEREQUAL,
116 BINEXPR_SHIFTLEFT_ASSIGN,
117 BINEXPR_SHIFTRIGHT_ASSIGN,
118 BINEXPR_BITWISE_AND_ASSIGN,
119 BINEXPR_BITWISE_XOR_ASSIGN,
120 BINEXPR_BITWISE_OR_ASSIGN,
122 } binary_expression_type_t;
124 struct binary_expression_t {
125 expression_t expression;
126 binary_expression_type_t type;
131 struct select_expression_t {
132 expression_t expression;
133 expression_t *compound;
136 declaration_t *compound_entry;
139 struct array_access_expression_t {
140 expression_t expression;
141 expression_t *array_ref;
145 struct sizeof_expression_t {
146 expression_t expression;
148 expression_t *size_expression;
151 struct conditional_expression_t {
152 expression_t expression;
153 expression_t *condition;
154 expression_t *true_expression;
155 expression_t *false_expression;
158 struct statement_expression_t {
159 expression_t expression;
160 statement_t *statement;
165 STORAGE_CLASS_TYPEDEF,
166 STORAGE_CLASS_EXTERN,
167 STORAGE_CLASS_STATIC,
169 STORAGE_CLASS_REGISTER,
170 STORAGE_CLASS_ENUM_ENTRY
173 struct declaration_t {
174 storage_class_t storage_class;
177 statement_t *statement;
178 expression_t *initializer;
179 source_position_t source_position;
189 STATEMENT_DECLARATION,
192 STATEMENT_EXPRESSION,
197 STATEMENT_CASE_LABEL,
204 statement_type_t type;
206 source_position_t source_position;
209 struct return_statement_t {
210 statement_t statement;
211 expression_t *return_value;
214 struct compound_statement_t {
215 statement_t statement;
216 statement_t *statements;
220 struct declaration_statement_t {
221 statement_t statement;
222 declaration_t *declarations_begin;
223 declaration_t *declarations_end;
225 int value_number; /**< filled in by semantic phase */
229 struct if_statement_t {
230 statement_t statement;
231 expression_t *condition;
232 statement_t *true_statement;
233 statement_t *false_statement;
236 struct switch_statement_t {
237 statement_t statement;
238 expression_t *expression;
242 struct goto_statement_t {
243 statement_t statement;
244 symbol_t *label_symbol;
245 label_statement_t *label;
248 struct case_label_statement_t {
249 statement_t statement;
250 expression_t *expression;
253 struct label_statement_t {
254 statement_t statement;
258 struct expression_statement_t {
259 statement_t statement;
260 expression_t *expression;
263 struct while_statement_t {
264 statement_t statement;
265 expression_t *condition;
269 struct do_while_statement_t {
270 statement_t statement;
271 expression_t *condition;
275 struct for_statement_t {
276 statement_t statement;
277 expression_t *initialisation;
278 expression_t *condition;
284 struct translation_unit_t {
289 void *_allocate_ast(size_t size)
291 return obstack_alloc(&ast_obstack, size);
294 #define allocate_ast(size) _allocate_ast(size)