




已閱讀5頁(yè),還剩4頁(yè)未讀, 繼續(xù)免費(fèi)閱讀
版權(quán)說(shuō)明:本文檔由用戶(hù)提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
clite語(yǔ)法類(lèi)型的非概要信息和意義 (2014025704-116),Program:Declarations 和一個(gè)Compound; Declaration:個(gè)體Declaration序列; Declaration:個(gè)體變量,其類(lèi)型和大?。?Type:int,bool,float,char集合的部分; Statement:子類(lèi)Compound,Skip,Assignment,Conditional和Loop; Compound:個(gè)體Statement序列,以他們出現(xiàn)的順序執(zhí)行。每一個(gè)出現(xiàn)在抽象語(yǔ)法樹(shù)的相同層次。 Skip:跳轉(zhuǎn)語(yǔ)句 Assignment:將表達(dá)式賦給變量的語(yǔ)句,conditional:一個(gè)表達(dá)式(test)和兩個(gè)語(yǔ)句(thenbranch和elsebranch),其中一個(gè)被執(zhí)行則另一個(gè)則跳過(guò)。在if-then語(yǔ)句,elsebranch作為一個(gè)Skip語(yǔ)句的實(shí)例。 Lood:一個(gè)表達(dá)式(test)和一個(gè)只要測(cè)試結(jié)果是ture就不斷重復(fù)的語(yǔ)句(循環(huán)體)。 Expression:子類(lèi)Variable,Value,Binary,和Unary; Binary:一個(gè)Operater和兩個(gè)Expression; Unary:一個(gè)Operator和兩個(gè)Expression; Operator: 數(shù)學(xué)運(yùn)算符:plus,minus,times,divide,Value:有子類(lèi)IntValue,FloatValue,BoolValue和CharValue intValue:整數(shù)值 FloatValue:浮點(diǎn)數(shù)值,描述從計(jì)算機(jī)近似值到一非整數(shù)值。 BoolValue:Boolean值,也就是說(shuō)不是ture就是false; Char Value:單個(gè)字符值;,Clite程序抽象語(yǔ)法樹(shù): Program=Declarations decpart; Statements body; Declaration=Declaration* Declaration=VarableDecl | ArrayDecl VariableDecl=Variable v;Type t ArrayDecl=Variable v;Typt t;Integer size Type= int | bool | float | char Statements=Statemment* statement=Skip | Block |Assignment |Conditional |Loop Skip= Block=Statements Conditionnal=Expression test ;Statement thenbranch,elsebranch Loop=Expression test;Statement body Assignment=VariableRef target;Expression source Expression=VariableRef | Value | Binary |Unary,Variable Ref=Variable | ArrayRef Binary=Operator op;Expression term1,term2 Unary=UnaryOp op;Expression term Operator=BooleanOp | RelationnalOp | ArithmeticOp BooleanlOp= Expression index Value = IntValue | BoolValue | FloatValue | CharValue IniValue =Integer intValue FloatValue=Float floatvalue BoolValue =Boolean boolvalue CharValue = Character charvalue/*仔細(xì)看一下其實(shí)也不難-取決你態(tài)度*/,A.1 Clite 詞匯和具體句法 /*所有引用變量必須聲明*/ Program int main () Declarations Statements Declarations Declaration Declaration Type Identifier integer .Identifier integer; Type int | bool | float | char Statements-Statement Statement: | Block | Assignment | If Statement | WhileStatement Block -Statement Assignment -Identifier Expression =Expression; If Statementif (Expression) Statement else Statement WhileStatement while (Expression) Statement ExpressionConjunction |Conjunction Conjunction Equality& Equality EqualityRelationEquOp Relation ,EquOp-= | != RelationAdditionRelOp Addition RelOp | = Addition Term AddOp Term AddOp+ | - Term Factor MulOp Factor MuiOp* | / | % FactorUnaryOpPrimary UnaryOp - | ! PrimaryIdentifier Expression | Literal | (Expression ) | Type (Expression) Identifier Letter Letter | Digit Boolean-true | false FloatInteger .Integer Char ASCIIChar,A.2 Clite 的抽象句法 /*所有聲明變量必須唯一*/ Program =Declarations decpart; Statements body; Declaration =Declaration* Declarations =VariableDecl | ArrayDecl VariableDecl = Variable V ; Type t ArrayDecl = Variable v;Type t;Integer size Type= int | bool | float | char Statements =Statement* Statement =Skip | Block | Assignment | Conditional | Loop Skip = Block=Statements Conditional=Experssion test;Statement thenbranch, elsebranch Loop=Expression test ;Statement body Assignment=VariableRef target ; Expression source Expression =VariableRef | Value |Binary | Unary VariableRef =Variable | ArrayRef,Binary=BinaryOp op;Expression term1,term2 Unary=UnaryOp op;Expression term1,term2 Operator=BooleanOp | RelationalOp | ArithmeticOp | UnaryOp BooleanlOp= Expression index
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶(hù)所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶(hù)上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶(hù)上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶(hù)因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 珠海格力職業(yè)學(xué)院《機(jī)器人電氣安裝調(diào)試》2023-2024學(xué)年第二學(xué)期期末試卷
- 硅湖職業(yè)技術(shù)學(xué)院《建筑小環(huán)境設(shè)計(jì)》2023-2024學(xué)年第二學(xué)期期末試卷
- 河北中醫(yī)藥大學(xué)《交通港站與樞紐》2023-2024學(xué)年第二學(xué)期期末試卷
- 赤峰學(xué)院《給水管網(wǎng)系統(tǒng)設(shè)計(jì)》2023-2024學(xué)年第二學(xué)期期末試卷
- 山西應(yīng)用科技學(xué)院《電子商務(wù)系統(tǒng)規(guī)劃與建設(shè)》2023-2024學(xué)年第二學(xué)期期末試卷
- 河南推拿職業(yè)學(xué)院《可信計(jì)算》2023-2024學(xué)年第二學(xué)期期末試卷
- 南昌航空大學(xué)《速寫(xiě)》2023-2024學(xué)年第二學(xué)期期末試卷
- 露營(yíng)計(jì)劃美術(shù)課件
- 生物統(tǒng)計(jì)學(xué)實(shí)驗(yàn)設(shè)計(jì)實(shí)驗(yàn)
- 大班故事《小馬過(guò)河》教學(xué)解析
- 保潔員滿(mǎn)意度調(diào)查問(wèn)卷
- 初中英語(yǔ)1000組固定詞組及句型搭配
- 周?chē)窠?jīng)損傷的康復(fù)761
- 神經(jīng)系統(tǒng)的健康評(píng)估 (健康評(píng)估課件)
- 佳能700d攝影技巧
- WS/T 92-1996血中鋅原卟啉的血液熒光計(jì)測(cè)定方法
- GA/T 383-2014法庭科學(xué)DNA實(shí)驗(yàn)室檢驗(yàn)規(guī)范
- (公共政策導(dǎo)論講稿)課件
- 護(hù)理文件書(shū)寫(xiě)原因魚(yú)骨圖
- 堤防工程施工規(guī)范課件
- 【教學(xué)課件】第六章 熟悉而陌生的力 第一節(jié) 力 精品課件
評(píng)論
0/150
提交評(píng)論