pcode.h

来自「第一次写的」· C头文件 代码 · 共 42 行

H
42
字号
// pcode.h: interface for the pcode class.
//
//////////////////////////////////////////////////////////////////////
#ifndef __PCODE_H
#define __PCODE_H

#include <string>
#include <iostream>
#include <fstream>

#define CODE_MAX 200
#define STACK_MAX 500

using namespace std;

typedef  enum { LIT, OPR, LOD, STO, CAL, INT, JMP, JPC ,RED ,WRT} fct;

typedef struct Ccode
{
	fct f;             //操作码
	int l;             //层次差
	int a;             //位移量
} CCode;

class pcode  
{
	friend class Grammar;
private:
	CCode code[CODE_MAX];     //目标代码
	int cx;                   //下标指针
	int b;                    //运行时栈指针
	int s[STACK_MAX];         //运行栈
public:
	pcode();
	void Gen(fct f,int l,int a);
	void Interpret();
	void PrintCode();
	void OutToFile(string &name);
	int base(int l);
};

#endif // pcode.h

⌨️ 快捷键说明

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