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