-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexpression.h
71 lines (55 loc) · 1.11 KB
/
expression.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
/**
* IFJ Project 2020: Team 008, variant II
*
* @file expression.h
*
* @brief Header file for expression.h
*
*
* @author Martin Kneslík <xknesl02@stud.fit.vutbr.cz>
* @author Adriana Jurkechová <xjurke02@stud.fit.vutbr.cz>
* @author Karel Norek <xnorek01@stud.fit.vutbr.cz>
* @author Petr Salaba <xsalab00@stud.fit.vutbr.cz>
*/
#ifndef __EXPRESSION_H__
#define __EXPRESSION_H__
#include "parser.h"
typedef enum {
PLUS,
MINUS,
MULTIPLY,
DIVIDE,
LEFT_BRACKET,
RIGHT_BRACKET,
LESSER,
LESS_OR_EQ,
GREATER,
GRT_OR_EQ,
EQUAL,
NOT_EQUAL,
ID,
INT,
FLOAT,
STRING,
DOLAR,
HANDLE,
NON_TERM
}Prec_symbol;
typedef enum {
I_PLUS_MINUS,
I_MUL_DIV,
I_LEFT_BRACKET,
I_RIGHT_BRACKET,
I_ID,
I_RELATION,
I_DOLAR
}Prec_index;
int cleanup(Parser parser, int error);
int getIndexFromSymbol(Prec_symbol symbol);
int getIndexFromToken(Parser parser);
int getSymbolFromToken(Parser parser);
int checkRule(int count, Parser parser);
int reduce(Parser parser);
int checkSemantic(bool firstToken, bool *divide, Parser parser);
int expression(Parser parser);
#endif //__EXPRESSION_H__