資源簡(jiǎn)介
編譯原理實(shí)驗(yàn),目的把用戶輸入的代碼轉(zhuǎn)化成匯編語(yǔ)言的代碼。一個(gè)簡(jiǎn)單的編譯器的實(shí)現(xiàn)。主要采用算符優(yōu)先的算法。開發(fā)環(huán)境VS2013,語(yǔ)言C++
在 BYYL.cpp中的讀取文件路徑中添加案例,如在a.txt中寫上
program test
var a : real ;var b:bool ;
begin
while A<C and B<D do
if A=1 then C:=C+1
else while A<=D do A:=A*2;
B := A+C+D+(-2)
end
在 BYYL.cpp中的讀取文件路徑中添加案例,如在a.txt中寫上
program test
var a : real ;var b:bool ;
begin
while A<C and B<D do
if A=1 then C:=C+1
else while A<=D do A:=A*2;
B := A+C+D+(-2)
end

代碼片段和文件信息
//?BYYL.cpp?:?定義控制臺(tái)應(yīng)用程序的入口點(diǎn)。
//
#include?“stdafx.h“
#include?
#include??
#include??
#include?“l(fā)astProduce.h“
using?namespace?std;
void?printGens()
{
for?(int?i?=?0;?i? {
cout?< }
}
int?_tmain(int?argc?_TCHAR*?argv[])
{
printReadtext(“F:/a.txt“);
flTable?t;
printTokenResult2(); //輸出token集
string?Error;
bool?b?=?t.Match(tokens?Error);??//完成優(yōu)先關(guān)系表,語(yǔ)法樹,輸出符號(hào)棧
if?(!b)?{?cout?< else?cout?<“規(guī)約成功“?< printGens(); //輸出四元式
codeTable?ct;
ct.printcodes(); ?//輸出代碼生成
system(“pause“);
return?0;
}
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2018-01-21?18:03??BYYL\
?????目錄???????????0??2018-01-21?18:03??BYYL\BYYL\
?????文件?????8912896??2018-01-21?18:03??BYYL\BYYL.sdf
?????文件?????????958??2018-01-21?18:03??BYYL\BYYL.sln
?????文件???????44032??2018-01-21?18:03??BYYL\BYYL.v12.suo
?????文件?????????843??2018-01-21?16:00??BYYL\BYYL\BYYL.cpp
?????文件????????4914??2018-01-21?13:37??BYYL\BYYL\BYYL.vcxproj
?????文件????????2146??2018-01-21?13:37??BYYL\BYYL\BYYL.vcxproj.filters
?????目錄???????????0??2018-01-21?18:00??BYYL\BYYL\Debug\
?????文件????????6497??2018-01-21?18:00??BYYL\BYYL\Debug\BYYL.log
?????文件?????1845634??2018-01-21?18:00??BYYL\BYYL\Debug\BYYL.obj
?????文件?????1638400??2018-01-17?10:37??BYYL\BYYL\Debug\BYYL.pch
?????目錄???????????0??2018-01-21?18:00??BYYL\BYYL\Debug\BYYL.tlog\
?????文件?????????188??2018-01-21?18:00??BYYL\BYYL\Debug\BYYL.tlog\BYYL.lastbuildstate
?????文件????????1566??2018-01-21?18:00??BYYL\BYYL\Debug\BYYL.tlog\cl.command.1.tlog
?????文件????????9332??2018-01-21?18:00??BYYL\BYYL\Debug\BYYL.tlog\CL.read.1.tlog
?????文件????????1366??2018-01-21?18:00??BYYL\BYYL\Debug\BYYL.tlog\CL.write.1.tlog
?????文件????????1460??2018-01-21?18:00??BYYL\BYYL\Debug\BYYL.tlog\li
?????文件????????2728??2018-01-21?18:00??BYYL\BYYL\Debug\BYYL.tlog\li
?????文件?????????736??2018-01-21?18:00??BYYL\BYYL\Debug\BYYL.tlog\li
?????文件???????11306??2018-01-17?10:37??BYYL\BYYL\Debug\stdafx.obj
?????文件??????371712??2018-01-21?18:00??BYYL\BYYL\Debug\vc120.idb
?????文件??????692224??2018-01-21?18:00??BYYL\BYYL\Debug\vc120.pdb
?????文件???????12896??2018-01-20?19:39??BYYL\BYYL\Fristvt.h
?????文件????????3619??2018-01-21?18:03??BYYL\BYYL\GenStruct.h
?????文件????????6838??2018-01-21?17:11??BYYL\BYYL\lastProduce.h
?????文件????????3606??2018-01-19?16:33??BYYL\BYYL\prog.h
?????文件????????1489??2018-01-17?09:13??BYYL\BYYL\ReadMe.txt
?????文件????????1002??2018-01-21?16:16??BYYL\BYYL\register.h
?????文件?????????210??2018-01-17?09:13??BYYL\BYYL\stdafx.cpp
?????文件?????????234??2018-01-17?09:13??BYYL\BYYL\stdafx.h
............此處省略11個(gè)文件信息
評(píng)論
共有 條評(píng)論