/* PL/0 编译系统 C 版本头文件 pl0.h */
typedef enum {false, true} bool;
#define norw 13 /* 关键字个数 */
#define txmax 100 /* 名字表容量 */
#define nmax 14 /* number 的最大位数 */
#define al 10 /* 符号的最大长度 */
#define amax 2047 /* 地址上界 */
#define levmax 3 /* 最大允许过程嵌套声明层数[0,levmax] */
#define cxmax 200 /* 最多的虚拟机代码数 */
enum symbol {nul, ident, number, plus, minus,
times, slash, oddsym, eql, neq,
lss, leq, gtr, geq, lparen,
rparen, comma, semicolon, period, becomes,
beginsym, endsym, ifsym, thensym, whilesym,
writesym, readsym, dosym, callsym, constsym,
varsym, procsym };
#define symnum 32
/* 名字表中的类型 */
enum object { constant, variable, procedur, array};
/* 虚拟机代码 */
enum fct { lit, opr, lod,
sto, cal, inte,
jmp, jpc };
#define fctnum 8
/* 虚拟机代码结构 */
struct instruction{ enum fct f;
int l;
int a; };
FILE* fas; FILE* fa; FILE* fa1; FILE* fa2;
bool listswitch; bool tableswitch;
char ch;
enum symbol sym;
char id[al+1];
int num; int cc, ll; int cx; char line[81];
char a[al+1];
struct instruction code[cxmax];
char word[norw][al];
enum symbol wsym[norw]; enum symbol ssym[256];
char mnemonic[fctnum][5];
bool declbegsys[symnum]; bool statbegsys[symnum]; bool facbegsys[symnum];
/* 名字表结构 */
struct tablestruct
{ char name[al];
enum object kind;