-
Notifications
You must be signed in to change notification settings - Fork 0
/
expr.h
64 lines (49 loc) · 1.27 KB
/
expr.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
/*
* Project name:
* Implementace interpretu imperativního jazyka IFJ14
*
* Repository:
* https://github.com/Dasio/IFJ
*
* Team:
* Dávid Mikuš (xmikus15)
* Peter Hostačný (xhosta03)
* Tomáš Kello (xkello00)
* Adam Lučanský (xlucan01)
* Michaela Lukášová (xlukas09)
*/
#include "symbol.h"
#include "error.h"
#include "vector.h"
#include "token.h"
#include "system.h"
#include "instruction.h"
#include "instructions_regular.h"
#include "interpreter.h"
#ifndef EXPR_H
#define EXPR_H
#define EXPR_ERROR -1
typedef enum { TERM, NONTERM } ExprTokenType;
typedef struct
{
Token *token; // data of TERM
Operand E; // data of NONTERM
ExprTokenType type; // TERM / NONTERM
bool handle_start; // handle is starting on this if this flag is true
} ExprToken;
GenVectorPrototypes(ExprToken)
typedef struct
{
ExprTokenVector *expr_vector;
ExprToken *first; // first token of handle
ExprToken *last; // last token of handle (last token in vector)
int first_index; // index to first token in handle
int last_index; // index to last token in handle
int tokens_count; // number of tokens in handle
} THandle;
/**
* Vector generation of type ExprToken
*/
// after a call of expr(), value of the expression is stored on the top of stack
DataType expr();
#endif