-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathparse.h
73 lines (61 loc) · 1.29 KB
/
parse.h
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#ifndef _PARSE_LIT_
#define _PARSE_LIT_
#include "common.h"
#include "var.h"
#include "token.h"
#include "func.h"
#include "var.h"
#include "ast.h"
#include "exprtype.h"
enum {
BLOCK_NORMAL = 0,
BLOCK_LOOP,
BLOCK_FUNC,
BLOCK_GLOBAL,
NON
};
class Parser {
public:
Token &tok;
int blocksCount;
std::vector<std::string> module;
Parser(Token &token)
:tok(token) { }
// expr.h
int is_string_tok();
int is_number_tok();
int is_ident_tok();
int is_char_tok();
std::map<std::string, int> op_prec;
int get_op_prec(std::string);
AST *expr_entry();
AST *expr_index();
AST *expr_dot();
AST *expr_unary();
AST *expr_primary();
AST *expr_array();
AST *expr_rhs(int, AST *);
// parse.h
AST *make_lib();
AST *make_proto();
AST *make_module();
AST *make_if();
AST *make_elsif();
AST *make_while();
AST *make_for();
AST *make_func();
AST *make_break();
AST *make_return();
AST *make_struct();
ast_vector eval();
AST *expression();
llvm::Module *parser();
int get_string();
std::map<std::vector<std::string>, bool> function_list;
bool is_func(std::vector<std::string>);
void append_func(std::vector<std::string>);
std::map<std::string, bool> local_var_list;
bool is_local_var(std::string);
void append_local_var(std::string);
};
#endif