aboutsummaryrefslogtreecommitdiff
path: root/src/as_parser.h
diff options
context:
space:
mode:
authorMistivia <i@mistivia.com>2025-03-25 17:59:11 +0800
committerMistivia <i@mistivia.com>2025-03-25 17:59:11 +0800
commit93d6f231d59b413b091b7e15a8af246a8b105c65 (patch)
treec6c239e6b0cc8d893561df6435db578bfb7b23a2 /src/as_parser.h
parent39e2a605f6d8ebcc3cb454daae3d0a4298df2eb6 (diff)
make code shorter
Diffstat (limited to 'src/as_parser.h')
-rw-r--r--src/as_parser.h21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/as_parser.h b/src/as_parser.h
index 2171fe4..f1d3b62 100644
--- a/src/as_parser.h
+++ b/src/as_parser.h
@@ -10,46 +10,53 @@ struct arg {
int64_t ival;
double fval;
};
+typedef struct arg arg;
struct instr {
enum op op;
- struct arg * arg;
+ arg* arg;
const char* tag_name;
+ int lineno;
};
+typedef struct instr instr;
struct label {
const char* name;
};
+typedef struct label label;
struct stmt {
struct label * label;
struct instr * instr;
};
+typedef struct stmt stmt;
struct stmts {
struct stmt ** stmts;
};
+typedef struct stmts stmts;
struct prog {
struct stmts * stmts;
};
+typedef struct prog prog;
// result<prog>
-struct result parse_prog(struct allocator * alct, struct token_stream * ts);
+result parse_prog(allocator* alct, token_stream* ts);
// result<stmt>
-struct result parse_stmt(struct allocator * alct, struct token_stream * ts);
+result parse_stmt(allocator* alct, token_stream* ts);
// result<stmts>
-struct result parse_stmts(struct allocator * alct, struct token_stream * ts);
+result parse_stmts(allocator* alct, token_stream* ts);
// result<instr>
-struct result parse_instr(struct allocator * alct, struct token_stream * ts);
+result parse_instr(allocator* alct, token_stream* ts);
// result<label>
-struct result parse_label(struct allocator * alct, struct token_stream * ts);
+result parse_label(allocator* alct, token_stream* ts);
// result<enum op>
-struct result parse_op(struct allocator * alct, struct token_stream * ts);
+result parse_op(allocator* alct, token_stream* ts);
#endif