-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathPL0.h
More file actions
72 lines (67 loc) · 1.89 KB
/
PL0.h
File metadata and controls
72 lines (67 loc) · 1.89 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#ifndef _PL0_H
#define _PL0_H
#include <cstddef>
#include <fcntl.h>
#include <fstream>
#include <io.h>
#include <iomanip>
#include <iostream>
#include <sstream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <tchar.h>
#include <unordered_map>
#include <vector>
#include <windows.h>
#include <winuser.h>
#ifndef UNICODE
#define UNICODE
#endif
#ifndef _UNICODE
#define _UNICODE
#endif
using namespace std;
#define PROGM_PATH \
"E:\\Programming\\GitHub\\repository\\DataStruct\\complierPL0\\testfib.txt"
#define RSV_WORD_MAX 15 /* 保留字的数量 */
#define N_MAX 14 /* 数字允许的最长位数 */
#define PROGM_CH_MAX 5000 /*源程序的最大字符数*/
#define ID_MAX 20 /* 标识符最大长度 */
#define OPR_MAX 11 /* 运算符号表最大长度*/
#define VAR_WIDTH 4 /*变量大小*/
#define CST_WIDTH 4 /*常量大小*/
#define SYM_ITEMS_CNT 100 // 符号表项数
#define PROC_CNT 40 // 过程嵌套数
#define ERR_CNT 70 // 报错种数
// 全局变量声明
extern size_t level; // 层差
extern size_t glo_offset; // 全局offset
extern wstring progm_w_str; // 源程序代码的wchar字符串形式
// first集声明
extern unsigned long first_block;
extern unsigned long first_stmt;
extern unsigned long first_factor;
extern unsigned long first_term;
extern unsigned long first_exp;
extern unsigned long first_lexp;
extern unsigned long first_lop;
// follow集声明
extern unsigned long follow_condecl;
extern unsigned long follow_vardecl;
extern unsigned long follow_body;
extern unsigned long follow_stmt;
extern unsigned long follow_lexp;
extern unsigned long follow_exp;
extern unsigned long follow_term;
extern unsigned long follow_factor;
extern unsigned long follow_ident;
extern unsigned long follow_block;
extern unsigned long follow_constdef;
extern unsigned long follow_proc;
// 函数声明
void init();
void readFile2USC2(string);
void PL0Test();
#endif