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

  • 大小: 854KB
    文件類型: .zip
    金幣: 2
    下載: 0 次
    發布日期: 2021-06-06
  • 語言: 其他
  • 標簽: LR翻譯器??四元式??

資源簡介

編譯原理課設---表達式的LR翻譯器,中間代碼為四元式,包括文檔和代碼

資源截圖

代碼片段和文件信息

#include
#include
#include
#include?
using?namespace?std;
??????????????????????????????//and or not true?false( ??) ??i ?rop???#?
???????????int?action[18][10]={?{?0 ?0 ?4 5 ?6 ?7 ?0 ?8 ?0 ??0}//0
{?9 ?0 ?0 0 ?0 ?0 -2 ?0 ?0 100}//1
{-2 10 ?0 0 ?0 ?0 -2 ?0 ?0 ?-2}//2
{-4 -4 ?0 0 ?0 ?0 -4 ?0 ?0 ?-4}//3
{?0 ?0 ?4 5 ?6 ?7 ?0 ?8 ?0 ??0}//4
{-7 -7 ?0 0 ?0 ?0 -7 ?0 ?0 ?-7}//5
{-8 -8 ?0 0 ?0 ?0 -8 ?0 ?0 ?-8}//6
{?0 ?0 ?4 5 ?6 ?7 ?0 ?8 ?0 ??0}//7
{?0 ?0 ?0 0 ?0 ?0 ?0 ?0 13 ??0}//8
{?0 ?0 ?4 5 ?6 ?7 ?0 ?8 ?0 ??0}//9
{?0 ?0 ?4 5 ?6 ?7 ?0 ?8 ?0 ??0}//10
{-5 -5 ?0 0 ?0 ?0 -5 ?0 ?0 ?-5}//11
{?9 ?0 ?0 0 ?0 ?0 16 ?0 ?0 ??0}//12
{?0 ?0 ?0 0 ?0 ?0 ?0 17 ?0 ??0}//13
{-1 10??0 0 ?0 ?0 -1 ?0 ?0 ?-1}//14
{-3 -3 ?0 0 ?0 ?0 -3 ?0 ?0 ?-3}//15
{-6 -6 ?0 0 ?0 ?0 -6 ?0 ?0 ?-6}//16
{-9 -9 ?0 0 ?0 ?0 -9 ?0 ?0 ?-9}};//17

???????????????????????????????//B???T????F
???????????int?gotol[18][3]={???{1 2 ?3}//0
????{0 0 ?0}//1
{0 0 ?0}//2
{0 0 ?0}//3
{0 0 11}//4
{0 0 ?0}//5
{0 0 ?0}//6
{12 2 ?3}//7
{0 0 ?0}//8
{0 14 ?3}//9
????????????????????????????????{0 0 15}//10
{0 0 ?0}//11
{0 0 ?0}//12
????????????????????????????????{0 0 ?0}//13
{0 0 ?0}//14
{0 0 ?0}//15
{0 0 ?0}//16
????????????????????????????????{0 0 ?0}};//17

//終結符集合
string?endls[10]={“and““or““not““true““false“?“(““)“?“i““rop““#“?};
//非終結符集合
string?noends[3]={“B““T““F“};
//產生式集合
string?products[10]={“B““B?and?T“?“T““T?or?F““F““not?F““(?B?)““true“?“false““i?rop?i“};
//棧類
class?statestack
{
private:
int?*base;//棧底指針
int?*top;//棧頂指針
int?size;//棧內元素個數
int?stacksize;//棧的大小
public:
statestack()
{
size=0;
stacksize=20;
base=new?int[stacksize];;
top=base;
}
int?getTop()//獲取棧頂的元素。
{
if(base==top)
{
return?-1;??
}
else
{
return?*(top-1);
}
}??
bool?statePush(int?elem)//元素入棧
{
++size;
(*top)=elem;
++top;
return?true;
}
void?statePop(int?time)//元素出棧
{
for(int?i=0;i {
--top;
--size;
}
}
void?printState()//輸出棧內的所有元素
{
string?str=“?“;
int?*pre;
for(pre=base;pre {
if(*pre>9)
{
char?ch1=(*pre/10)+48;
char?ch2=(*pre%10)+48;
????????????????str+=ch1;
str+=ch2;
}
else
{
????????????????????char?ch=*pre+48;
????str+=ch;
}
}
cout<se::left)< }
};

class?symbolstack
{
private

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????10608??2014-01-13?11:40??BoolAnalyze.cpp
?????文件??????720913??2014-01-13?11:49??李帥奇.docx
?????文件???????32053??2014-01-13?11:43??源代碼.docx
?????文件??????114176??2014-01-06?11:53??繪圖1.vsd
?????文件??????116736??2014-01-05?16:04??繪圖4.vsd

評論

共有 條評論