📄 code.h
字号:
//code,h
//代码生成类
#pragma once
#ifndef __CCODE_H
#define __CCODE_H
#include "Symtax.h"
#define CODE_SIZE 200
#define RUN_STACK_SIZE 500 //运行栈的容量
enum fct {lit,opr,lod,sto,cal,tint,jmp,jpc};
struct instruction
{
fct f; //命令代码
int l; //层差
int a; //转移地址
};
class CCode
{
public:
CCode(CPl0*p);
~CCode(void);
void Gen(fct f,int l,int a);//代码生成函数
void ListCode(); //列出目标代码
void Interpret(); //解释器函数
//private:
instruction code[CODE_SIZE];//代码栈
int cx; //代码指针
int b; //程序基地址指针
int s[RUN_STACK_SIZE]; //数据栈
private:
int base(int l);
CPl0 *pl;
};
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -