?? pc.cpp
字號(hào):
// xyzPL/0 Compiler
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <string.h>
#include "pl0.h"
void main(int argc,char *argv[])
{
char filename[256];
printf("xyzpl/0 compiler (imitate pl/0 compiler) version 1.0\nWriten by xyzyang, 2007-6-5\nATTENTION: enter 'q' to exit the compiler\n");
if (argc!=2)
{
printf("source file:");
gets(filename);
}
else
strcpy(filename,argv[1]);
CPlCompiler pl(filename);
char ch;
if (pl.FileEmpty())
{
printf("source file cannot be opened!\n");
while(getch()!='q')
{
getch();
}
exit(0);
}
printf("list source file?(y/n): ");
ch=getch();
while (ch!='y'&&ch!='n')
{
ch=getch();
}
printf("%c\n",ch);
if (ch=='y')
{
pl.DisplaySrcfile();
}
printf("compiling...\n\n");
pl.Compile();
if (pl.ErrorNumber())
{
pl.DisplayErrors();
printf("\ncontinue?(y/n): ");
ch=getch();
while (ch!='y'&&ch!='n')
{
ch=getch();
}
printf("%c\n",ch);
if (ch=='n') exit(1);
}
printf("list object code?(y/n): ");
ch=getch();
while (ch!='y'&&ch!='n') ch=getch();
printf("%c\n",ch);
if (ch=='y') pl.ListCode();
printf("start to run the programe...............\n");
pl.Interpret();
while(getch()!='q')
getch();
exit(0);
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -