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

  • 大小: 35KB
    文件類型: .rar
    金幣: 2
    下載: 0 次
    發(fā)布日期: 2021-07-22
  • 語(yǔ)言: 其他
  • 標(biāo)簽:

資源簡(jiǎn)介

我的編譯原理課程設(shè)計(jì),請(qǐng)大家多多指教!!!

資源截圖

代碼片段和文件信息

//?GrammerAnalysis.cpp:?implementation?of?the?GrammerAnalysis?class.
//
//////////////////////////////////////////////////////////////////////

#include?“stdafx.h“
#include?“PL0.h“
#include?“GrammerAnalysis.h“


#ifdef?_DEBUG
#undef?THIS_FILE
static?char?THIS_FILE[]=__FILE__;
#define?new?DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
//?Construction/Destruction
//////////////////////////////////////////////////////////////////////


GrammerAnalysis::GrammerAnalysis(CString?set_of_token[])
{
int?itr?=?0;
while(set_of_token[itr]?!=?“200“?&&?set_of_token[itr]?!=?““)
{
// ::AfxMessageBox(set_of_token[itr++]);
this->set_of_token[itr]?=?set_of_token[itr];
itr++;
}

//測(cè)試代碼
// itr?=?0;
// while(this->set_of_token[itr]?!=?““?&&?strcmp(set_of_token[itr]“200“)?!=?0)
// {
// ::AfxMessageBox(this->set_of_token[itr++]);
// }

this->StartAnalysis();

}

GrammerAnalysis::~GrammerAnalysis()
{

}

token_type?GrammerAnalysis::GetToken()
{
CString?str_tmp_token?=?set_of_token[token_itr++];
int?int_tmp_token?=?atoi(str_tmp_token);
return?current_token?=?(token_type)int_tmp_token; //當(dāng)前token
}

void?GrammerAnalysis::error(int?line_num?CString?str_msg)
{

}

void?GrammerAnalysis::StartAnalysis()
{
this->GetToken();
this->loop();
}

void?GrammerAnalysis::loop()
{
if(current_token?!=?ENDFILE)
{
// ::AfxMessageBox(“己到文件尾“);
if(current_token?==?KEYID_CONST) //如果是CONST常量變量則必須初始化賦值
{
const_match();
}
else?if(current_token?==?KEYID_VAR) //VAR變量不必初始化
{
var_match();
}
else?if(current_token?==?KEYID_PROCEDURE)
{
this->procedure_match();
}

Statement(); //繼續(xù)語(yǔ)句匹配
}
return;

}

void?GrammerAnalysis::MATCH(token_type?token)
{
if(this->current_token?==?token)
{
if(this->current_token?==?SEMI)
{
cur_line++;
}
this->GetToken();
}
else
{
this->error(cur_line“不匹配的TOKEN“);
}
}

void?GrammerAnalysis::const_match()
{
this->GetToken();
if(this->current_token?==?ID)
{
MATCH(EQ);
MATCH(NUM);
MATCH(SEMI);
::AfxMessageBox(“CONST?匹配成功“);
}
else
{
::AfxMessageBox(“CONST?匹配失敗“);
}
}

void?GrammerAnalysis::var_match()
{
this->GetToken();
MATCH(ID);
while(this->current_token?==?COMMA)
{
::AfxMessageBox(“var“);
this->GetToken();
MATCH(ID);
}
MATCH(SEMI);
}

void?GrammerAnalysis::procedure_match()
{
this->GetToken();
MATCH(ID);
MATCH(SEMI);
this->GetToken();
this->loop();
}

void?GrammerAnalysis::Statement()
{
while(this->current_token?==?ENDFILE)
{
this->loop();
}
}

?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----

?????文件??????24576??2007-11-30?10:56??語(yǔ)法分析結(jié)構(gòu).doc

?????文件????????470??2007-12-04?11:25??PL0\cffxjg.txt

?????文件???????2710??2007-12-04?11:25??PL0\GrammerAnalysis.cpp

?????文件????????983??2007-12-04?10:56??PL0\GrammerAnalysis.h

?????文件??????20348??2007-11-29?11:08??PL0\PL0.APS

?????文件????????932??2007-11-30?11:10??PL0\PL0.clw

?????文件???????2021??2007-11-10?20:21??PL0\PL0.cpp

?????文件???????4370??2007-11-30?11:10??PL0\PL0.dsp

?????文件????????531??2007-11-10?20:21??PL0\PL0.dsw

?????文件???????1291??2007-11-10?20:21??PL0\PL0.h

?????文件??????66560??2007-12-04?11:25??PL0\PL0.ncb

?????文件??????53760??2007-12-04?11:25??PL0\PL0.opt

?????文件??????19308??2007-12-04?11:25??PL0\PL0.plg

?????文件???????5088??2007-11-29?10:26??PL0\PL0.rc

?????文件??????11187??2007-12-04?10:45??PL0\PL0Dlg.cpp

?????文件???????2747??2007-12-04?10:47??PL0\PL0Dlg.h

?????文件???????3525??2007-11-10?20:21??PL0\ReadMe.txt

?????文件???????1078??2007-11-10?20:21??PL0\res\PL0.ico

?????文件????????395??2007-11-10?20:21??PL0\res\PL0.rc2

?????文件????????773??2007-11-29?10:26??PL0\resource.h

?????文件????????205??2007-11-10?20:21??PL0\StdAfx.cpp

?????文件???????1054??2007-11-10?20:21??PL0\StdAfx.h

?????文件????????338??2007-12-04?11:16??PL0\test.pl0

?????文件????????838??2007-11-29?10:25??PL0\XEdit.cpp

?????文件???????1162??2007-11-29?10:22??PL0\XEdit.h

?????目錄??????????0??2007-12-04?11:34??PL0\res

?????目錄??????????0??2007-12-04?11:35??PL0

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

???????????????226250????????????????????27



............此處省略0個(gè)文件信息

評(píng)論

共有 條評(píng)論