42 lines
690 B
C
42 lines
690 B
C
#pragma once
|
|
|
|
struct token;
|
|
|
|
struct expression {
|
|
struct token constant;
|
|
};
|
|
|
|
enum statement_type {
|
|
STATEMENT_RETURN,
|
|
STATEMENT_IF_ELSE,
|
|
};
|
|
|
|
struct statement;
|
|
|
|
struct statement_return {
|
|
struct expression * expression;
|
|
};
|
|
|
|
struct statement_if_else {
|
|
struct expression * expression;
|
|
struct statement * statement_if;
|
|
struct statement * statement_else;
|
|
};
|
|
|
|
struct statement {
|
|
enum statement_type type;
|
|
union {
|
|
struct statement_return * statement_return;
|
|
struct statement_if_else * statement_if_else;
|
|
};
|
|
};
|
|
|
|
struct function_definition {
|
|
struct token * name;
|
|
struct statement * statements;
|
|
};
|
|
|
|
struct program {
|
|
struct function_definition * function_definition;
|
|
};
|