plx.h

来自「一个PLX教学编译器IDE」· C头文件 代码 · 共 46 行

H
46
字号

#ifndef __PLX__H_
#define __PLX__H_

#define MAX_CODENUMBER    2048 
#define MAX_STACK         (2048*2)

#include <stdio.h>
#include <fstream.h>
#include <string.h>

class plxw  
{
public:
	plxw();
	~plxw();

	void debug(char *filePath);
protected:

	ifstream InFile;
	enum instruction{OPR,LIT,LOD,STO,INT,JMP,JPC,SHO,CAL};
	typedef enum instruction fct;

	typedef struct _code{ int f;
                          int l;
	                      int a;
	}CODE;

	/* 存储代码的数组和指标 */
	CODE code[MAX_CODENUMBER];
	int  cx;
	/*  虚拟机  */  
    int  s[MAX_STACK];          /*  运行栈           */
	int  t;                          /*  运行栈指针       */
	CODE i;                          /*  指令寄存器       */
	int  p;                          /*  PC寄存器         */
	int  b;                          /*  基地址寄存器     */

	void fillCode();
	void interpret(); 
	int  base(int l);	
};

#endif 

⌨️ 快捷键说明

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