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

  • 大小: 1.35MB
    文件類型: .rar
    金幣: 2
    下載: 0 次
    發布日期: 2023-11-08
  • 語言: 其他
  • 標簽: 編譯器??

資源簡介

學校大三課程的編譯器設計實驗作業,基于擴展c0文法的編譯器設計,編譯最終結果為MIPS代碼,優化未做。包括源程序,說明文檔,測試程序三部分。

資源截圖

代碼片段和文件信息

#ifndef?GRAMMER
#define?GRAMMER
#include?
#include?
#include?
#include?
#include?
#include?“getsym.h“
#include?“midcode.h“

#define?idLength?50
#define?symtabLength?512
#define?maxPre?512

typedef?struct{
char?id[idLength];
int?type; //0--const1--var2--func3--para
int?value; //常量的值,type為函數時,0表示void,1表示int,2表示char
int?address; //標識符存儲地址或地址偏移
int?para; //函數的參數個數?或?數組的長度
char?funcLabelGlo[256];?////函數的地址(第一條語句)
}Symbol;

typedef?struct{
Symbol?symtab[symtabLength]; //符號表
int?index; //符號表棧頂指針,即符號表中的符號總數量?/////最開始為0
int?blocksnum; //當前符號表擁有的分程序總數?/////////////////最開始為0
int?blocksindex[maxPre]; //分程序索引 ////symTab.blocksindex[0]?=?1;
}SymbolTab;

//////////////////////全局變量聲明
char?id[idLength];
int?type;
int?value;
int?address;
int?para;
char?labelAdd[256];
Symbol?symtab[symtabLength];
int?index;
int?blocksnum;
int?blocksindex;
SymbolTab?symTab;///////符號表



/////////////預讀取的標識符串和標識符的種類
?char?temp1[128]temp2[128];
?//////////char?*symid1*symid2;牢記少用指針,用指針要malloc,不然是野指針
?char?tempID[128];///////////用于因子中向外傳遞的指針
?int?isArr?=?0;
?int?funcOrIden;
?int?subscript;
?int?searchValue;
?int?searchAdd;
?char?searchLabel[256];
?int?isFirstBlock;

?int?arrNum?=?0;
?int?t;
?char?nowTerm[128];
?int?isConst;
?char?tempCon[128];
?char?tempFunc[128];
?
?char?funcLabelGlo[256]?=?{0};
?int?tempStep?=?0;
?char?condition01[256];
?char?funcDefRet[256];
?char?funcCallTemp[256];
?char?senID[256];
?char?constantNum[256];
?char?switchExp[256];
?char?endLabel[256];
////////////函數的聲明
?void?insertSymTab(char?*idint?typeint?valueint?addressint?parachar?*labelAdd);
?void?searchSymTab(char?*idint?funcOrIdenint?isArrint?subscript);
?void?initSymTab();

void?Exp();
void?Sentence();
void?Factor();
void?SentenceList();
void?Term();
void?ConDef();
void?ConExplain();

void?VarDefChar();
void?VarDefInt();
void?VarExplain();

void?Cycle();
void?Condition();
void?Assign();
void?FuncCall1();
void?FuncCall0();
void?Scanf();
void?Printf();
void?Return();
void?Main();
void?FuncDef1();
void?FuncDef0();
void?Default();
void?Integer();
void?Constant();
void?Case();
void?Switch();
void?ComSen();
void?Step();
void?CondiSen();
///////////函數定義
void?insertSymTab(char?*idint?typeint?valueint?addressint?parachar?*funcLabelGlo){
if(type?==?2){////////////函數名,只需查找各個分程序的入口即函數入口的名稱是否重復即可
for(i=1;i if(strcmp(idsymTab.symtab[symTab.blocksindex[i]].id)?==?0){
//////error
return;
}
}
blocksnum++;
}else?{////////////////變量名,需查找該層符號表中是否有重復
i?=?symTab.blocksindex[symTab.blocksnum];
for(;i if(strcmp(idsymTab.symtab[i].id)?==?0){
////////error
return;
}
}
}
////////////若無符號表重名?則開始填符號表
strcpy(symTab.symtab[index-1].idid);
symTab.symtab[index-1].type?=?type;
symTab.symtab[inde

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件?????255173??2018-01-13?22:56??文檔\15061050_余琦_設計文檔.docx

?????文件???????4717??2017-12-12?14:50??源程序\compile\compile\compile.vcxproj

?????文件???????1692??2017-12-12?14:50??源程序\compile\compile\compile.vcxproj.filters

?????文件????????143??2017-11-13?23:55??源程序\compile\compile\compile.vcxproj.user

?????文件???????3342??2018-01-14?09:10??源程序\compile\compile\Debug\cl.command.1.tlog

?????文件???????8654??2018-01-14?09:10??源程序\compile\compile\Debug\CL.read.1.tlog

?????文件???????2508??2018-01-14?09:10??源程序\compile\compile\Debug\CL.write.1.tlog

?????文件???????1786??2017-11-29?15:54??源程序\compile\compile\Debug\compile.Build.CppClean.log

?????文件????????406??2017-11-29?15:54??源程序\compile\compile\Debug\compile.exe.embed.manifest

?????文件????????472??2018-01-14?09:10??源程序\compile\compile\Debug\compile.exe.embed.manifest.res

?????文件????????381??2018-01-14?09:10??源程序\compile\compile\Debug\compile.exe.intermediate.manifest

?????文件?????????88??2018-01-14?09:10??源程序\compile\compile\Debug\compile.lastbuildstate

?????文件??????60154??2018-01-14?09:10??源程序\compile\compile\Debug\compile.log

?????文件???????1449??2017-11-29?16:17??源程序\compile\compile\Debug\compile.vcxprojResolveAssemblyReference.cache

?????文件??????76969??2018-01-14?09:10??源程序\compile\compile\Debug\compile.write.1.tlog

?????文件????????204??2017-11-29?15:54??源程序\compile\compile\Debug\compile_manifest.rc

?????文件?????108886??2017-12-12?09:23??源程序\compile\compile\Debug\grammer.obj

?????文件??????????2??2018-01-14?09:10??源程序\compile\compile\Debug\link-cvtres.read.1.tlog

?????文件??????????2??2018-01-14?09:10??源程序\compile\compile\Debug\link-cvtres.write.1.tlog

?????文件??????????2??2018-01-14?09:10??源程序\compile\compile\Debug\link.1056-cvtres.read.1.tlog

?????文件??????????2??2018-01-14?09:10??源程序\compile\compile\Debug\link.1056-cvtres.write.1.tlog

?????文件??????????2??2018-01-14?09:10??源程序\compile\compile\Debug\link.1056.read.1.tlog

?????文件??????????2??2018-01-14?09:10??源程序\compile\compile\Debug\link.1056.write.1.tlog

?????文件??????????2??2018-01-14?09:10??源程序\compile\compile\Debug\link.10832-cvtres.read.1.tlog

?????文件??????????2??2018-01-14?09:10??源程序\compile\compile\Debug\link.10832-cvtres.write.1.tlog

?????文件??????????2??2018-01-14?09:10??源程序\compile\compile\Debug\link.10832.read.1.tlog

?????文件??????????2??2018-01-14?09:10??源程序\compile\compile\Debug\link.10832.write.1.tlog

?????文件??????????2??2018-01-14?09:10??源程序\compile\compile\Debug\link.11312-cvtres.read.1.tlog

?????文件??????????2??2018-01-14?09:10??源程序\compile\compile\Debug\link.11312-cvtres.write.1.tlog

?????文件??????????2??2018-01-14?09:10??源程序\compile\compile\Debug\link.11312.read.1.tlog

............此處省略96個文件信息

評論

共有 條評論