diff options
Diffstat (limited to 'src/as_parser.h')
| -rw-r--r-- | src/as_parser.h | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/src/as_parser.h b/src/as_parser.h index 3306909..a3db024 100644 --- a/src/as_parser.h +++ b/src/as_parser.h @@ -2,6 +2,7 @@ #define FVM_AS_PARSER_H_ #include "as_tokenizer.h" +#include "utils.h" #include "as_op.h" @@ -9,41 +10,41 @@ struct arg { int64_t ival; double fval; }; -typedef struct arg Arg; +typedef struct arg * Arg; struct instr { - Op op; - Arg* arg; + enum op op; + Arg arg; const char* tagName; }; -typedef struct instr Instr; +typedef struct instr *Instr; struct label { const char* name; }; -typedef struct label Label; +typedef struct label *Label; struct stmt { - Label* label; - Instr* instr; + Label label; + Instr instr; }; -typedef struct stmt Stmt; +typedef struct stmt *Stmt; struct stmts { - Stmt** stmts; + Stmt* stmts; }; -typedef struct stmts Stmts; +typedef struct stmts *Stmts; struct prog { - Stmts *stmts; + Stmts stmts; }; -typedef struct prog Prog; - -Prog* parseProg(TokenStream *ts); -Stmt* parseStmt(TokenStream *ts); -Stmts* parseStmts(TokenStream *ts); -Instr* parseInstr(TokenStream *ts); -Label* parseLabel(TokenStream *ts); -Op parseOp(TokenStream *ts); +typedef struct prog *Prog; + +Prog parseProg(Allocator alct, TokenStream ts); +Stmt parseStmt(Allocator alct, TokenStream ts); +Stmts parseStmts(Allocator alct, TokenStream ts); +Instr parseInstr(Allocator alct, TokenStream ts); +Label parseLabel(Allocator alct, TokenStream ts); +enum op parseOp(Allocator alct, TokenStream ts); #endif |
