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

  • 大小: 164KB
    文件類型: .rar
    金幣: 2
    下載: 2 次
    發布日期: 2021-05-14
  • 語言: 其他
  • 標簽: 編譯原理??

資源簡介

編制程序,完成局部優化過程中的基本塊劃分。給定一段代碼,判定程序的入口語句,劃分基本塊,刪除無用產生式和冗余節點。

資源截圖

代碼片段和文件信息

#include?
#include?
#include?
#include?
#include?
using?namespace?std;
/********************************************************************/
/*?Deceleration?of?structures???????????????????????????????????????????*/
/********************************************************************/
struct?Four{
string?op; ????//?操作符
string?arg1; //?第一個操作數
string?arg2; //?第二個操作數
string?result; //?結果
int?stylenum; ???? //?結點類型
struct?Four?*next; ???? //?指向下一條語句的起始位置
struct?Four?*last; //?指向上一條語句的起始位置 ????
};
struct?DagNode{?
string?bsf; //?標識符
string?var; //?副標識符
int?flag; //?標記位
struct?DagNode?*lchild; //?指向孩子的指針
struct?DagNode?*rchild; //?指向右孩子的指針
struct?DagNode?*next; //?指向下一個結點
};
/********************************************************************/
/*?Global?variables????????????????????????????????????????????????????*/
/********************************************************************/
Four?*fhead;
DagNode?*nhead;
std::list?list_Dag;
vector?input_source;??//模板函數
/********************************************************************/
/*?implementation?of?functions??????????????????????????????????????????*/
/********************************************************************/
void?do_input()
{
// 第五個測試用例 結合實驗3的輸出結果
input_source.push_back(“/32t1“);
input_source.push_back(“?t1?a“);
input_source.push_back(“+s8t2“);
input_source.push_back(“?t2?b“);



}
void?DataFour() //?建立四元式的結構映射
{
struct?Four?*fourTmp?=?new?Four;
fourTmp->last?=?NULL;
fourTmp->next?=?NULL;
//for(//----------1補充條件)
for(int?i=0;i {
struct?Four?*pp?=?new?Four;
pp->next?=?NULL;
pp->last?=?fourTmp;
fourTmp->next?=?pp;
if(!pp)??//內存分配失敗
{
cout<<“Memory?allocation?failed!“< return;
}
char?op[10]={0};
char?arg1[10]={0};
char?arg2[10]={0};
char?result[10]={0};
sscanf(input_source[i].c_str()“%[^]%[^]%[^]%[^\n]“?oparg1arg2result);??//?sscanf()?-?從一個字符串中讀進與指定格式相符的數據
pp->op=op;
pp->arg1=arg1;
pp->arg2=arg2;
pp->result=result;
if(pp->arg2?==?“?“)
if(pp->op?==?“?“)
//----------2補充語句 //第二個操作數為空并且操作符為空,則為0型四元式
????????pp->stylenum=0;
else
//----------3補充語句 //第二個操作數為空并且操作符不空,則為1型四元式
????????pp->stylenum=1;
else
//----------4補充語句 //第二個操作數不為空,則為2型四元式
????????pp->stylenum=2;
fourTmp?=?pp;
}
fhead?=?fourTmp;
}
void?ListBuild() //?建立鏈表
{
for(int?i?=?1;?fhead->last?!=?NULL;?fhead?=?fhead->last) //從最后一個四元式開始構造鏈表
{
DagNode?*tmp1?=?new?DagNode;
DagNode?*tmp2?=?new?DagNode;
DagNode?*tmpResult?=?new?DagNode;
tmp1->lchild?=?NULL;
tmp1->rchild?=?NULL;
tmp1->next?=?NULL;
tmp2->lchild?=?NULL;
tmp2->rchild?=?NULL;
tmp2->next?=?NULL;
tmpResult->lchild?=?NULL;
tmpResult->rchild?=?NULL;
tmpResult->next?=?NULL;
nhead?=?new?DagNode;
nhead->next?=

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

?????文件???????7059??2014-06-10?10:32??中間代碼優化\中間代碼優化.cpp

?????文件?????101853??2014-06-04?21:49??中間代碼優化\中間代碼優化.docx

?????文件?????153088??2014-06-10?11:02??中間代碼優化\中間代碼優化實驗報告.doc

?????目錄??????????0??2014-06-10?13:34??中間代碼優化

-----------?---------??----------?-----??----

???????????????262000????????????????????4


評論

共有 條評論