blob: 0c31df79a08c397951e40b8912e5c59b98e21e2c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
#ifndef FVM_AS_PARSER_H_
#define FVM_AS_PARSER_H_
#include "as_tokenizer.h"
#include "utils.h"
#include "as_op.h"
struct arg {
int64_t ival;
double fval;
};
typedef struct arg * arg_t;
struct instr {
enum op op;
arg_t arg;
const char* tag_name;
};
typedef struct instr * instr_t;
struct label {
const char* name;
};
typedef struct label * label_t;
struct stmt {
label_t label;
instr_t instr;
};
typedef struct stmt * stmt_t;
struct stmts {
stmt_t * stmts;
};
typedef struct stmts * stmts_t;
struct prog {
stmts_t stmts;
};
typedef struct prog * prog_t;
prog_t parse_prog(allocator_t alct, token_stream_t ts);
stmt_t parse_stmt(allocator_t alct, token_stream_t ts);
stmts_t parse_stmts(allocator_t alct, token_stream_t ts);
instr_t parse_instr(allocator_t alct, token_stream_t ts);
label_t parse_label(allocator_t alct, token_stream_t ts);
enum op parse_op(allocator_t alct, token_stream_t ts);
#endif
|