-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsyntaxAnalys.h
More file actions
47 lines (43 loc) · 1.54 KB
/
syntaxAnalys.h
File metadata and controls
47 lines (43 loc) · 1.54 KB
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
#include "error.h"
#include "symbolTable.h"
#include <fstream>
#define MISS_TOKEN { \
reportError(E_MISS_TOKEN); \
char until[6] = { ';','\n','{','}','(',')'}; \
skip(until, 6); \
curState = E_MISS_TOKEN; \
}
#ifndef SYNTAXANALYS_H
#define SYNTAXANALYS_H
#define TMP_VAR (string("&tmp")+to_string(TMP_VAR_COUNT++)).c_str()
#define LABLE (string("$lable")+to_string(LABLE_COUNT++)).c_str()
#define EXCEPTVALUE 10101010
extern int TMP_VAR_COUNT;
extern int LABLE_COUNT;
extern bool hasRetrun;
using namespace std;
void seekSp(streampos sp);
int recgProgram(int level);
int recgValIntro(int level);
int recgValDef(int level);
int recgVarIntro(int level);
int recgVarDef(int level);
int recgFuncDef(int level);
int recgCompound(int level);
int recgParaList(int level, struct tableNode * funcnode);
int recgMain(int level);
int recgExpression(int level, struct tableNode * tmpnode);
int recgTerm(int level, struct tableNode * tmpnode);
int recgFactor(int level, struct tableNode * tmpnode);
int recgStatement(int level);
int recgAssign(int level);
int recgIf(int level);
int recgCondition(int level,char * Label, bool satisfy); //生成一个跳转语句, satisfy为真则满足条件时跳转,否则为不满足时跳转
int recgRepeat(int level);
int recgIFuncCall(int level, struct tableNode * tmpnode);
int recgNFuncCall(int level);
int recgValueParaList(int level, struct tetraCode & head, int *len, struct tableNode func);
int recgRead(int level);
int recgWrite(int level);
int recgReturn(int level);
#endif