⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 daima.h

📁 一个小型的编译器,仿照PL/0实现,能实现pl/0全部功能
💻 H
字号:
#ifndef __DAIMA_H
#define __DAIMA_H

#include "yufa.h"

#define CODE_SIZE	200         //maximzation of the code-size(代码的最大长度)
#define RUN_STACK_SIZE	500		//runtime stack size(运行时分配给程序的堆栈空间)

enum fct {lit,opr,lod,sto,cal,intint,jmp,jpc};

struct instruction
{
	fct f;	//fuction code(操作功能码)
	int l;	//level (层次差)
	int a;	//displacement addr 
};

class CDaima
{
    friend class CYufa;
public:
	CDaima(){cx=0;}
	void Gen(fct f,int l,int a);
	void ListCode();
	void Interpret();

private:
	instruction code[CODE_SIZE];
	int cx;

	int b;	//program stack base address
	int s[RUN_STACK_SIZE];	//datastore
private:
	int base(int l);
};

#endif // daima.h

⌨️ 快捷键说明

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