10 extern struct obstack ast_obstack;
26 declaration_t *declarations;
27 compound_type_t *structs;
28 compound_type_t *unions;
29 compound_type_t *enums;
33 expresion_type_t type;
35 source_position_t source_position;
39 expression_t expression;
43 struct string_literal_t {
44 expression_t expression;
48 struct reference_expression_t {
49 expression_t expression;
51 declaration_t *declaration;
54 struct call_argument_t {
55 expression_t *expression;
56 call_argument_t *next;
59 struct call_expression_t {
60 expression_t expression;
62 call_argument_t *arguments;
69 UNEXPR_BITWISE_NEGATE,
73 UNEXPR_POSTFIX_INCREMENT,
74 UNEXPR_POSTFIX_DECREMENT,
75 UNEXPR_PREFIX_INCREMENT,
76 UNEXPR_PREFIX_DECREMENT,
78 } unary_expression_type_t;
80 struct unary_expression_t {
81 expression_t expression;
82 unary_expression_type_t type;
112 BINEXPR_SHIFTLEFT_ASSIGN,
113 BINEXPR_SHIFTRIGHT_ASSIGN,
114 BINEXPR_BITWISE_AND_ASSIGN,
115 BINEXPR_BITWISE_XOR_ASSIGN,
116 BINEXPR_BITWISE_OR_ASSIGN
117 } binary_expression_type_t;
119 struct binary_expression_t {
120 expression_t expression;
121 binary_expression_type_t type;
126 struct select_expression_t {
127 expression_t expression;
128 expression_t *compound;
131 declaration_t *compound_entry;
134 struct array_access_expression_t {
135 expression_t expression;
136 expression_t *array_ref;
140 struct sizeof_expression_t {
141 expression_t expression;
145 struct conditional_expression_t {
146 expression_t expression;
147 expression_t *condition;
148 expression_t *true_expression;
149 expression_t *false_expression;
152 struct expression_list_element_t {
153 expression_t *expression;
157 struct comma_expression_t {
158 expression_t expression;
159 expression_list_element_t *expressions;
164 STORAGE_CLASS_TYPEDEF,
165 STORAGE_CLASS_EXTERN,
166 STORAGE_CLASS_STATIC,
168 STORAGE_CLASS_REGISTER
171 struct declaration_t {
172 storage_class_t storage_class;
175 statement_t *statement;
176 expression_t *initializer;
177 source_position_t source_position;
187 STATEMENT_DECLARATION,
189 STATEMENT_EXPRESSION,
196 statement_type_t type;
198 source_position_t source_position;
201 struct return_statement_t {
202 statement_t statement;
203 expression_t *return_value;
206 struct compound_statement_t {
207 statement_t statement;
208 statement_t *statements;
212 struct declaration_statement_t {
213 statement_t statement;
214 declaration_t declaration;
216 int value_number; /**< filled in by semantic phase */
220 struct if_statement_t {
221 statement_t statement;
222 expression_t *condition;
223 statement_t *true_statement;
224 statement_t *false_statement;
227 struct goto_statement_t {
228 statement_t statement;
229 symbol_t *label_symbol;
230 label_statement_t *label;
233 struct label_statement_t {
234 statement_t statement;
238 struct expression_statement_t {
239 statement_t statement;
240 expression_t *expression;
243 struct translation_unit_t {
248 void *_allocate_ast(size_t size)
250 return obstack_alloc(&ast_obstack, size);
253 #define allocate_ast(size) _allocate_ast(size)