#include "ast.h"
#include "symbol.h"
-#include "lexer_t.h"
+#include "token_t.h"
#include "type.h"
#include "adt/obst.h"
EXPR_SIZEOF,
} expresion_type_t;
+struct context_t {
+ declaration_t *declarations;
+};
+
struct expression_t {
expresion_type_t type;
type_t *datatype;
};
struct reference_expression_t {
- expression_t expression;
- symbol_t *symbol;
- union {
- declaration_t *declaration;
- } r;
+ expression_t expression;
+ symbol_t *symbol;
+ declaration_t *declaration;
};
struct call_argument_t {
};
struct select_expression_t {
- expression_t expression;
- expression_t *compound;
- symbol_t *symbol;
+ expression_t expression;
+ expression_t *compound;
+ symbol_t *symbol;
- compound_entry_t *compound_entry;
+ declaration_t *compound_entry;
};
struct array_access_expression_t {
struct sizeof_expression_t {
expression_t expression;
- union {
- type_t *type;
- expression_t *size_expression;
- } v;
+ type_t *type;
};
struct conditional_expression_t {
method_parameter_t *parameters;
statement_t *statement;
source_position_t source_position;
+ context_t context;
+
+ declaration_t *next;
};
typedef enum {
STATEMENT_INVALID,
- STATEMENT_BLOCK,
+ STATEMENT_COMPOUND,
STATEMENT_RETURN,
STATEMENT_DECLARATION,
STATEMENT_IF,
expression_t *return_value;
};
-struct block_statement_t {
+struct compound_statement_t {
statement_t statement;
statement_t *first_statement;
+ context_t context;
};
struct declaration_statement_t {
expression_t *expression;
};
-struct unit_entry_t {
- declaration_t declaration;
- unit_entry_t *next;
-};
-
struct translation_unit_t {
- unit_entry_t *entries;
+ context_t context;
};
static inline