91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

資源簡介

功能完整的PL0編譯器,附帶多個測試用例,可以用于編譯技術課程實踐參考

資源截圖

代碼片段和文件信息

//?pl0?compiler?source?code

#include?
#include?
#include?
#include?
#include?“set.h“
#include?“pl0.h“
char?total[MAXIDLEN?+?1];
//#include?“set.c“
int?flag1=0sign=0;
//////////////////////////////////////////////////////////////////////
//?print?error?message.
//出錯處理
void?error(int?n)
{
int?i;

printf(“??????“);
for?(i?=?1;?i?<=?cc?-?1;?i++)
printf(“?“);
fprintf(outfile?“?“);
fprintf(outfile?“^\n“);
printf(“^\n“);
fprintf(outfile?“Error?%3d:?%s\n“?n?err_msg[n]);
printf(“Error?%3d:?%s\n“?n?err_msg[n]);
err++;
}?//?error

//////////////////////////////////////////////////////////////////////
//獲取下一個字符
void?getch(void)
{
if?(cc?==?ll)
{
if?(feof(infile))
{
printf(“\nPROGRAM?INCOMPLETE\n“);
exit(1);
}
ll?=?cc?=?0;
fprintf(outfile?“%5d??“?cx);
printf(“%5d??“?cx);
while?(?(!feof(infile))?//?added?&?modified?by?alex?01-02-09
????&&?((ch?=?getc(infile))?!=?‘\n‘))
{
fprintf(outfile?“%c“?ch);
printf(“%c“?ch);
line[++ll]?=?ch;
}?//?while
fprintf(outfile?“\n“);
printf(“\n“);
line[++ll]?=?‘?‘;
}
ch?=?line[++cc];
}?//?getch

//////////////////////////////////////////////////////////////////////
//?gets?a?symbol?from?input?stream.
void?zhushi()
{
while(ch!=‘*‘)
{
getch();
}
if(ch==‘*‘)
{
getch();
if(ch==‘)‘)
getch();
else
{
zhushi();
}
}
else
{
error(27); ????//報錯
}
}
//////////////////////////////////////////////////////////////////////
//?gets?a?symbol?from?input?stream.
//詞法分析,獲取下一個標識符
void?getsym(void)
{
int?i?k;
char?a[MAXIDLEN?+?1];

while?(ch?==?‘?‘||?ch?==?‘\t‘)
//?modified?by?yzhang?02-03-12add?some?white?space
getch();

if?(isalpha(ch))
{?//?symbol?is?a?reserved?word?or?an?identifier.
k?=?0;
do
{
if?(k? a[k++]?=?ch;
getch();
}
while?(isalpha(ch)?||?isdigit(ch));
a[k]?=?0;
strcpy(id?a);
word[0]?=?id;
i?=?NRW;
while?(strcmp(id?word[i--]));
if?(++i)
sym?=?wsym[i];?//?symbol?is?a?reserved?word
else
sym?=?SYM_IDENTIFIER;???//?symbol?is?an?identifier
}
else?if?(isdigit(ch))
{?//?symbol?is?a?number.
k?=?num?=?0;
sym?=?SYM_NUMBER;
do
{
num?=?num?*?10?+?ch?-?‘0‘;
k++;
getch();
}
while?(isdigit(ch));
if?(k?>?MAXNUMLEN)
error(25);?????//?The?number?is?too?great.
}
else?if?(ch?==?‘:‘)
{
getch();
if?(ch?==?‘=‘)
{
sym?=?SYM_BECOMES;?//?:=
getch();
}
else
{
sym?=?SYM_COLON;???????//?illegal?
}
}
else?if?(ch?==?‘>‘)
{
getch();
if?(ch?==?‘=‘)
{
sym?=?SYM_GEQ;?????//?>=
getch();
}
else
{
sym?=?SYM_GTR;?????//?>
}
}
else?if?(ch?==?‘<‘)
{
getch();
if?(ch?==?‘=‘)
{
sym?=?SYM_LEQ;?????//?<=
getch();
}
else?if?(ch?==?‘>‘)
{
sym?=?SYM_NEQ;?????//?<>
getch();
}
else
{
sym?=?SYM_LES;?????//?<
}

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2012-07-19?14:04??pl0\Debug\
?????文件???????14846??2012-07-19?14:04??pl0\Debug\BuildLog.htm
?????文件?????????444??2004-08-27?22:30??pl0\Debug\hbin.txt
?????文件??????????67??2012-07-19?14:04??pl0\Debug\mt.dep
?????文件??????393216??2012-07-19?14:04??pl0\Debug\pl0.exe
?????文件?????????406??2012-07-19?13:50??pl0\Debug\pl0.exe.embed.manifest
?????文件?????????472??2012-07-19?13:50??pl0\Debug\pl0.exe.embed.manifest.res
?????文件?????????381??2012-07-19?14:04??pl0\Debug\pl0.exe.intermediate.manifest
?????文件??????242156??2012-07-19?14:04??pl0\Debug\pl0.ilk
?????文件???????71198??2012-07-19?14:04??pl0\Debug\pl0.obj
?????文件?????1936384??2012-07-19?14:04??pl0\Debug\pl0.pdb
?????文件????????8720??2012-07-19?13:50??pl0\Debug\set.obj
?????文件????????1641??2004-08-27?22:30??pl0\Debug\test.out
?????文件?????????233??2004-08-27?22:25??pl0\Debug\test.pl0
?????文件???????????0??2004-08-27?22:21??pl0\Debug\test.pl0.bak
?????文件???????41984??2012-07-18?10:35??pl0\Debug\vc60.idb
?????文件???????53248??2012-07-18?10:35??pl0\Debug\vc60.pdb
?????文件???????44032??2012-07-19?14:04??pl0\Debug\vc90.idb
?????文件???????61440??2012-07-19?14:04??pl0\Debug\vc90.pdb
?????文件?????????832??2012-07-18?10:35??pl0\hbin.txt
?????文件???????27237??2012-07-19?14:23??pl0\pl0.c
?????文件????????4420??2004-08-27?22:34??pl0\pl0.dsp
?????文件?????????529??2004-08-27?22:34??pl0\pl0.dsw
?????文件????????5613??2012-07-18?10:19??pl0\pl0.h
?????文件??????470016??2012-07-19?14:23??pl0\pl0.ncb
?????文件???????48640??2012-07-18?10:36??pl0\pl0.opt
?????文件?????????893??2012-07-18?10:35??pl0\pl0.plg
?????文件?????????871??2012-07-19?13:50??pl0\pl0.sln
?????文件????????9728??2012-07-19?14:23??pl0\pl0.suo
?????文件????????5632??2012-07-19?13:50??pl0\pl0.vcproj
?????文件????????1409??2012-07-19?14:23??pl0\pl0.vcproj.LENOVO.Administrator.user
............此處省略10個文件信息

評論

共有 條評論