📄 pcode.h
字号:
// 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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -