B-Minor Abstract Syntax Tree

decl.h param_list.h
struct decl {
	char *name;
	struct type *type;
	struct expr *value;
	struct stmt *code;
	struct symbol *symbol;
	struct decl *next;
};
struct param_list {
	char *name;
	struct type *type;
	struct symbol *symbol;
	struct param_list *next;
};
stmt.h
struct stmt {
	stmt_t kind;
	struct decl *decl;
	struct expr *init_expr;
	struct expr *expr;
	struct expr *next_expr;
	struct stmt *body;
	struct stmt *else_body;
	struct stmt *next;
};
typedef enum {
	STMT_DECL,
	STMT_EXPR,
	STMT_IF_ELSE,
	STMT_FOR,
	STMT_PRINT,
	STMT_RETURN,
	STMT_BLOCK
} stmt_t;
expr.h
struct expr {
	expr_t kind;
	struct expr *left;
	struct expr *right;
	const char *name;
	struct symbol *symbol;
	int literal_value;
	const char * string_literal;
};
typedef enum {
	EXPR_ADD,
	EXPR_SUB,
	EXPR_MUL,
	EXPR_DIV,
	...
	EXPR_INTEGER_LITERAL,
	EXPR_STRING_LITERAL
} expr_t;
type.h
struct type {
	type_t kind;
	struct type *subtype;
	struct param_list *params;
};
typedef enum {
	TYPE_BOOLEAN,
	TYPE_CHARACTER,
	TYPE_INTEGER,
	TYPE_STRING,
	TYPE_ARRAY,
	TYPE_FUNCTION,
	TYPE_VOID
} type_t;