cifa.h
来自「简单易用 易看的编译器 带词法分析和语法分析 输出是二元式和四元式 使用读取文件」· C头文件 代码 · 共 79 行
H
79 行
#include "iostream.h"
#include "stdio.h"
#include "string.h"
#define ID 1
#define INT 2
#define ADD 16
#define SUB 17
#define MUL 18
#define DIV 19
#define SY 20
#define SS 21
#define XS 22
#define LT 23
#define LE 24
#define GT 25
#define GE 26
#define EQ 27
#define NE 28
#define FZ 29
#define FH 30
#define JH 31
#define DH 32
#define LKH 33
#define RKH 34
#define MH 35
struct KeyWord //关键字结构
{
char word[20];
int id;
};
struct ReCode //标识符结构
{
char word[20];
int idaddr;
};
struct CifaResult
{
int type;//0:error,1:id,2:num,3-:keyword and operator,-1:end note
int value;//二元式中value值
char text[20];//单词
int address;//源文件缓冲区中地址
};
class cifa
{
public:
KeyWord keyword[13];
FILE *fp;
ReCode recode[1000];
CifaResult cifaresult[10000];
cifa(FILE *fp1);
char token[20];
int idaddr;//
int huanhang;
int cur_ty;//当前2员式的地址
void reporterrors(char errorch[20]);
void reporterror(char errorch);//报错函数;
int lookup(char *string);
int lookuprecode(char *string);
void out(int id ,char *string);
bool isalpha(char c) ;
bool isdigit(char c);
bool isalnum(char c);
void scanner();
};
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?