10 extern struct obstack ast_obstack;
26 declaration_t *declarations;
30 expresion_type_t type;
32 source_position_t source_position;
36 expression_t expression;
40 struct string_literal_t {
41 expression_t expression;
45 struct reference_expression_t {
46 expression_t expression;
48 declaration_t *declaration;
51 struct call_argument_t {
52 expression_t *expression;
53 call_argument_t *next;
56 struct call_expression_t {
57 expression_t expression;
59 call_argument_t *arguments;
66 UNEXPR_BITWISE_NEGATE,
70 UNEXPR_POSTFIX_INCREMENT,
71 UNEXPR_POSTFIX_DECREMENT,
72 UNEXPR_PREFIX_INCREMENT,
73 UNEXPR_PREFIX_DECREMENT,
75 } unary_expression_type_t;
77 struct unary_expression_t {
78 expression_t expression;
79 unary_expression_type_t type;
109 BINEXPR_SHIFTLEFT_ASSIGN,
110 BINEXPR_SHIFTRIGHT_ASSIGN,
111 BINEXPR_BITWISE_AND_ASSIGN,
112 BINEXPR_BITWISE_XOR_ASSIGN,
113 BINEXPR_BITWISE_OR_ASSIGN
114 } binary_expression_type_t;
116 struct binary_expression_t {
117 expression_t expression;
118 binary_expression_type_t type;
123 struct select_expression_t {
124 expression_t expression;
125 expression_t *compound;
128 declaration_t *compound_entry;
131 struct array_access_expression_t {
132 expression_t expression;
133 expression_t *array_ref;
137 struct sizeof_expression_t {
138 expression_t expression;
142 struct conditional_expression_t {
143 expression_t expression;
144 expression_t *condition;
145 expression_t *true_expression;
146 expression_t *false_expression;
149 struct expression_list_element_t {
150 expression_t *expression;
154 struct comma_expression_t {
155 expression_t expression;
156 expression_list_element_t *expressions;
161 STORAGE_CLASS_TYPEDEF,
162 STORAGE_CLASS_EXTERN,
163 STORAGE_CLASS_STATIC,
165 STORAGE_CLASS_REGISTER
168 struct method_parameter_t {
169 method_parameter_t *next;
175 struct declaration_t {
176 storage_class_t storage_class;
179 method_parameter_t *parameters;
180 statement_t *statement;
181 source_position_t source_position;
191 STATEMENT_DECLARATION,
193 STATEMENT_EXPRESSION,
199 statement_type_t type;
201 source_position_t source_position;
204 struct return_statement_t {
205 statement_t statement;
206 expression_t *return_value;
209 struct compound_statement_t {
210 statement_t statement;
211 statement_t *first_statement;
215 struct declaration_statement_t {
216 statement_t statement;
217 declaration_t declaration;
219 int value_number; /**< filled in by semantic phase */
223 struct if_statement_t {
224 statement_t statement;
225 expression_t *condition;
226 statement_t *true_statement;
227 statement_t *false_statement;
230 struct goto_statement_t {
231 statement_t statement;
232 symbol_t *label_symbol;
233 label_statement_t *label;
236 struct label_statement_t {
237 statement_t statement;
241 struct expression_statement_t {
242 statement_t statement;
243 expression_t *expression;
246 struct translation_unit_t {
251 void *_allocate_ast(size_t size)
253 return obstack_alloc(&ast_obstack, size);
256 #define allocate_ast(size) _allocate_ast(size)