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

資源簡介

這是我們的課程設計,一個C語言小子集的四元式生成,改成匯編也很方便@!!

資源截圖

代碼片段和文件信息

#include“grammar.h“

void?Grammar::showCode()?{
int?tabcnt?=?0;
bool?flag?=?false;
bool?IF?=?false;
bool?ELSE?=?false;
for?(auto?&word?:?Format)?{
if?(word?==?“未知符號錯誤“)?break;
if?(word?==?“if“)?IF?=?true;
if?(word?==?“}“)?tabcnt--;
if?(word?==?“{“?||?word?==?“}“)?{
cout?< }
if?(word?==?“else“)?cout?< int?t?=?tabcnt;
if?(flag?||?word?==?“{“?||?word?==?“}“)?{
while?(t--)?cout?< if?(ELSE)cout?< flag?=?false;
}
cout?< if?(word?==?“else“)?cout?< if?(word?==?“{“)?tabcnt++;
if?(word?==?“;“?||?word?==“}“?||?word==“{“)?cout?< if?(IF?&&?word?==?“)“)?cout?< }
}
void?Grammar::debug()?{
cout?<<“ln:“<}
WORD?Grammar::errors(string?str)?{
int?row?=?nowWord.row;
int?col?=?nowWord.col;
errorTable.push_back(WORD(str?ERROR?row?col));
return?WORD(str?ERROR?row?col);
}
void?Grammar::showFour()?{
for?(int?i?=?1;?i? cout?< cout?< }
cout?<}
void?Grammar::run()?{
parseS();
if?(errorTable.size()?==?0)?{
showFour();
}?else?{
cout?< for?(int?i?=?0;?i? WORD?now?=?errorTable[i];
cout<<“錯誤編號“< cout?< cout?< cout?< }
}
}
void?Grammar::makeFour(string?a?string?b?string?c?string?d)?{
Fours.push_back(Four(a?b?c?d));
}
void?Grammar::GetNewWord()?{
nowWord?=?lex.getWord();
Format.push_back(nowWord.word);
}
//?S->main?A
void?Grammar::parseS(){
GetNewWord();
if?(nowWord.word?!=?“main“)?{
errors(“main匹配失敗“);
}
else?GetNewWord();
parseA();
}
//?A->(){B}
void?Grammar::parseA()?{
if?(nowWord.word?!=?“(“)?{
errors(“缺少(“);
}?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
else?GetNewWord();
if?(nowWord.word?!=?“)“)?{
errors(“缺少)“);
}
else?GetNewWord();
if?(nowWord.word?!=?“{“)?{
errors(“缺少{“);
}
else?GetNewWord();
parseB();
if?(nowWord.word?!=?“}“)?{
errors(“缺少}“);
}
else?GetNewWord();
}
//?分析B?<分程序>::=<變量說明部分>;<語句部分>
//?B->Def?;?F
//?F?代表語句部分
//?select?=?{int}
void?Grammar::parseB()?{
parseDef();
if?(nowWord.word?!=?“;“)?errors(“缺少分號“);
else?GetNewWord();
parseF();
}
//?Def?->?int?LIST
void?Grammar::parseDef()?{
if?(nowWord.word?!=?“int“)?{
errors(“缺少變量聲明部分中的int“);
}
else?GetNewWord();
parseList();

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

????..A..H.?????44544??2019-01-01?14:45??源代碼\Compiler\.vs\Compiler\v15\.suo

?????文件????6279168??2019-01-01?07:32??源代碼\Compiler\.vs\Compiler\v15\Browse.VC.db

????..A..H.????????46??2019-01-01?14:26??源代碼\Compiler\.vs\Compiler\v15\Browse.VC.opendb

?????文件???39649280??2019-01-01?14:26??源代碼\Compiler\.vs\Compiler\v15\ipch\AutoPCH\2ad8544a4b9f25e4\GRAMMAR.ipch

?????文件???41680896??2019-01-01?14:26??源代碼\Compiler\.vs\Compiler\v15\ipch\AutoPCH\481bd3790af93714\GRAMMAR.ipch

?????文件???41680896??2019-01-01?14:26??源代碼\Compiler\.vs\Compiler\v15\ipch\AutoPCH\58c149eb7fe50928\MAIN.ipch

?????文件???41680896??2018-12-24?13:47??源代碼\Compiler\.vs\Compiler\v15\ipch\AutoPCH\6f61545a27b7de65\LEXICAL.ipch

?????文件???41680896??2018-11-22?13:41??源代碼\Compiler\.vs\Compiler\v15\ipch\AutoPCH\f60ffc8bf46a8b17\GRAMMAR.ipch

?????文件???????6416??2018-11-22?13:53??源代碼\Compiler\Compiler\Compiler.vcxproj

?????文件???????1573??2018-11-22?13:53??源代碼\Compiler\Compiler\Compiler.vcxproj.filters

?????文件????????165??2018-11-16?13:40??源代碼\Compiler\Compiler\Compiler.vcxproj.user

?????文件?????????96??2019-01-01?14:45??源代碼\Compiler\Compiler\Debug\Compiler.log

?????文件???????2186??2019-01-01?14:45??源代碼\Compiler\Compiler\Debug\Compiler.tlog\CL.command.1.tlog

?????文件??????62404??2019-01-01?14:45??源代碼\Compiler\Compiler\Debug\Compiler.tlog\CL.read.1.tlog

?????文件???????4850??2019-01-01?14:45??源代碼\Compiler\Compiler\Debug\Compiler.tlog\CL.write.1.tlog

?????文件????????214??2019-01-01?14:45??源代碼\Compiler\Compiler\Debug\Compiler.tlog\Compiler.lastbuildstate

?????文件???????1528??2019-01-01?14:45??源代碼\Compiler\Compiler\Debug\Compiler.tlog\link.command.1.tlog

?????文件???????4042??2019-01-01?14:45??源代碼\Compiler\Compiler\Debug\Compiler.tlog\link.read.1.tlog

?????文件????????750??2019-01-01?14:45??源代碼\Compiler\Compiler\Debug\Compiler.tlog\link.write.1.tlog

?????文件?????892317??2019-01-01?04:00??源代碼\Compiler\Compiler\Debug\grammar.obj

?????文件?????511484??2018-12-24?14:23??源代碼\Compiler\Compiler\Debug\lexical.obj

?????文件?????551298??2019-01-01?14:45??源代碼\Compiler\Compiler\Debug\Main.obj

?????文件?????281600??2019-01-01?14:45??源代碼\Compiler\Compiler\Debug\vc141.idb

?????文件?????626688??2019-01-01?14:45??源代碼\Compiler\Compiler\Debug\vc141.pdb

?????文件????????492??2018-12-23?17:26??源代碼\Compiler\Compiler\defination.h

?????文件???????9466??2019-01-01?04:00??源代碼\Compiler\Compiler\grammar.cpp

?????文件???????2614??2018-12-24?13:13??源代碼\Compiler\Compiler\grammar.h

?????文件????????128??2019-01-01?03:59??源代碼\Compiler\Compiler\input.txt

?????文件???????3439??2018-12-24?14:23??源代碼\Compiler\Compiler\lexical.cpp

?????文件???????1217??2018-11-28?13:27??源代碼\Compiler\Compiler\lexical.h

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

評論

共有 條評論