This repository has been archived by the owner on Feb 1, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
parser.h
67 lines (57 loc) · 1.82 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
57
58
59
60
61
62
63
64
65
66
67
/**
* Predmet: IFJ / IAL
* Projekt: Implementace interpretu imperativniho jazyka IFJ13
* Tym: 099
* Varianta: a/2/I
* Soubor: parser.h
* Autori: Vlcek Michael <[email protected]>
* Svacek Radim <[email protected]>
* Blanco Roman <[email protected]>
* Micka Vojtech <[email protected]>
* Wolfert Richard <[email protected]>
*/
#ifndef PARSER_H_INCLUDED
#define PARSER_H_INCLUDED
//Definicia chybovych stavov
#define LEX_ERR -3
#define SYNT_ERR -4
#define SEM_ERR -5
#define SEM_ERR_MISS_PAR -6
#define SEM_ERR_UNDEF -7
#define SEM_ERR_NULL_DIV -10
#define SEM_ERR_RETYPE -11
#define SEM_ERR_ARITH -12
#define SEM_ERR_OTHER -13
#define RET_ERR -99
#define SYNT_OK 1
#define LEFT_ARROW 120
#define RIGHT_ARROW 121
#define EXCLAMATION 122
#define EQUALITY 123
#define DOLLAR_SIGN 124
#include "ial.h"
#include "expr_list.h"
FILE *f;
int program();
int parse(t_stItemV *VTableRoot,t_stItemF *FTableRoot, tInstList *GlobalInstList);
int StateID();
int StateKeyWord();
int StateIf();
int StateIfCore(tInstListItem *JumpInst);
int StateElse(tInstListItem *JumpInst);
int StateElseCore(tInstListItem *JumpInst);
int StateWhile();
int StateWhileCore(tInstListItem *JumpInstCont,tInstListItem *JumpInstBreak);
int StateFunction();
int StateFunctionCore(t_stItemF FunctionPtr);
int StateReturn();
int StateFunctionCall();
void expr_analysis_init(char (*)[9][9]);
int StateExpression();
int StateExpressionAnalysis (tDLList *);
int StateExpressionEvaluation(tDLList *);
int GenerateInstruction(int inst_type,void* addr1,void* addr2, void* result);
int GenerateInstructionList(int inst_type,void* addr1,void* addr2,void* result, tInstList* InstList);
char *GenerateString(int index);
char *GenerateStringExpr (int index);
#endif