gencode.h

来自「pascal的编译器 交作业没问题」· C头文件 代码 · 共 20 行

H
20
字号
#include "stdio.h"
#include "Analyze.h"
class VM;
class GenCode{
private:
	FILE * codefile;
	int IP,MP;    //IP是代码地址,MP是内存指针
	Analyze *analyze;
public:
	Instruction *codes;
	GenCode(){};
	void Init(FILE *file,Analyze *analyze); 
    void genStmt( TreeNode * tree);
	void genExp( TreeNode * tree);
    void cGen( TreeNode * tree);
	void codeGen(TreeNode * syntaxTree);   //代码生成主函数
	void emitCode(char *op,int p1,int p2); //生成一句三元式指令
	void backPatch(int loc);               //回填函数
	void printCodes();
};

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?