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

📄 pl0.cpp

📁 PL/0编译器
💻 CPP
字号:
#include "StdAfx.h"
#include ".\pl0.h"
#include "Wording.h"
#include "Errors.h"
#include "Form.h"
#include "Code.h"
#include "Symtax.h"

CPl0::CPl0(char *filename)
{
	if (fp=fopen(filename,"r"))
	{
		errors=new CErrors(this);
		form=new CForm(this);
		code=new CCode(this);
		wording=new CWording(this);
		symtax=new CSymtax(this);
		flnm = filename;
	}
}

CPl0::~CPl0(void)
{
	if (fp) 
		fclose(fp);
}

int CPl0::Compile()
{
	if (!fp)
		return 0;

	symtax->Analysis();

	return 1;
}

void CPl0::ShowSrcfile()
{
	if (!fp) 
		return;
	long pos=ftell(fp);
	fseek(fp,0,SEEK_SET);
	char ch;
	while((ch=getc(fp))!=EOF) 
		putchar(ch);
	putchar('\n');

	fseek(fp,pos,SEEK_SET);
}

int CPl0::ErrorNumber()
{
	if (!errors) 
		return 0;
	return errors->Number();
}

void CPl0::ShowErrors()
{
	if (errors) 
		errors->Show();
}

void CPl0::ListCode()
{
	code->ListCode();
}

void CPl0::Interpret()
{
	code->Interpret();
}

⌨️ 快捷键说明

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