?? pl0.cpp
字號:
#include <stdio.h>
#include "pl0.h"
#include "cifa.h"
#include "errors.h"
#include "biaoge.h"
#include "daima.h"
#include "yufa.h"
CPlCompiler::CPlCompiler(char *filename)
{
if (fp=fopen(filename,"r"))
{
errors=new CErrors(this);
biaoge=new CBiaoge(this);
daima=new CDaima;
cifa=new CCifa(this);
yufa=new CYufa(this);
}
else
{
cifa=0;
errors=0;
daima=0;
biaoge=0;
yufa=0;
}
}
CPlCompiler::~CPlCompiler()
{
if (cifa) delete cifa;
if (errors) delete errors;
if (daima) delete daima;
if (biaoge) delete biaoge;
if (yufa) delete yufa;
if (fp) fclose(fp);
}
int CPlCompiler::Compile()
{
if (cifa==NULL && yufa==NULL && daima==NULL && errors==NULL && biaoge==NULL && fp==NULL)
return 0;
yufa->Analysis();
return 0;
}
void CPlCompiler::DisplaySrcfile()
{
if (fp==NULL) 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 CPlCompiler::ErrorNumber()
{
if (errors==NULL) return 0;
return errors->Number();
}
void CPlCompiler::DisplayErrors()
{
if (errors!=NULL) errors->Display();
}
void CPlCompiler::ListCode()
{
if (daima!=NULL) daima->ListCode();
}
void CPlCompiler::Interpret()
{
if (daima!=NULL) daima->Interpret();
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -