-
Notifications
You must be signed in to change notification settings - Fork 0
/
parser.h
56 lines (44 loc) · 1.16 KB
/
parser.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
/**
* Project: IFJ21 imperative language compiler
*
* Author: David Chocholaty <xchoch09>
*
*/
#ifndef IFJ_BRATWURST2021_PARSER_H
#define IFJ_BRATWURST2021_PARSER_H
#include <stdbool.h>
#include "scanner.h"
#include "symtable.h"
#include "sym_linked_list.h"
#include "paramstack.h"
#include "ids_list.h"
#define PARSE_NO_ERR false
#define PARSE_ERR true
typedef bool parser_error_t;
typedef enum e_arg_ret {
ARG_DEF_TYPE,
RET_DEF_TYPE
} arg_ret_t;
typedef struct p_data {
token_t* token;
LList* tbl_list;
char* func_name;
char* body_func_name;
unsigned write_params_cnt;
arg_ret_t arg_ret;
data_type_t type;
data_type_t psa_data_type; // psa data type
unsigned returns_def_count;
function_params_t* param;
function_returns_t* ret;
ids_list_t* ids_list;
param_stack* stack;
bool return_func_body;
bool if_while;
} *p_data_ptr_t;
parser_error_t parser ();
bool check_identifier_is_defined (LList* tbl_list, char* id);
data_type_t identifier_type (LList* tbl_list, char* id);
void next_token(p_data_ptr_t data);
bool is_func(LList* tbl_list, char* id);
#endif //IFJ_BRATWURST2021_PARSER_H