




已閱讀5頁,還剩4頁未讀, 繼續(xù)免費閱讀
版權說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權,請進行舉報或認領
文檔簡介
clite語法類型的非概要信息和意義 (2014025704-116),Program:Declarations 和一個Compound; Declaration:個體Declaration序列; Declaration:個體變量,其類型和大小; Type:int,bool,float,char集合的部分; Statement:子類Compound,Skip,Assignment,Conditional和Loop; Compound:個體Statement序列,以他們出現(xiàn)的順序執(zhí)行。每一個出現(xiàn)在抽象語法樹的相同層次。 Skip:跳轉語句 Assignment:將表達式賦給變量的語句,conditional:一個表達式(test)和兩個語句(thenbranch和elsebranch),其中一個被執(zhí)行則另一個則跳過。在if-then語句,elsebranch作為一個Skip語句的實例。 Lood:一個表達式(test)和一個只要測試結果是ture就不斷重復的語句(循環(huán)體)。 Expression:子類Variable,Value,Binary,和Unary; Binary:一個Operater和兩個Expression; Unary:一個Operator和兩個Expression; Operator: 數(shù)學運算符:plus,minus,times,divide,Value:有子類IntValue,FloatValue,BoolValue和CharValue intValue:整數(shù)值 FloatValue:浮點數(shù)值,描述從計算機近似值到一非整數(shù)值。 BoolValue:Boolean值,也就是說不是ture就是false; Char Value:單個字符值;,Clite程序抽象語法樹: 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/*仔細看一下其實也不難-取決你態(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. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經(jīng)權益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
- 6. 下載文件中如有侵權或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 風險管理與評估試題及答案
- 《世界古代建筑欣賞:大二藝術史教學教案》
- 《太陽系八大行星的特點:四年級地理教學教案》
- 新員工入職流程及操作系統(tǒng)使用指南
- 產(chǎn)品分銷與代理業(yè)務合作協(xié)議內(nèi)容
- 《走進物理世界:高一物理實驗課程教案》
- 鄉(xiāng)村旅游農(nóng)業(yè)開發(fā)方案
- 年度市場活動策劃與執(zhí)行報告
- 公司采購協(xié)議附件書
- 采購居間合同例文
- 廣東省廣州市各縣區(qū)鄉(xiāng)鎮(zhèn)行政村村莊村名明細及行政區(qū)劃代碼
- 小學數(shù)學北師大二年級下冊六認識圖形認識角的導學單
- 綠化移植施工方案及技術措施
- 《竹枝詞》-完整版PPT
- 貴州區(qū)域地質地史概述
- Aptitude態(tài)度的重要性
- 《推薦》500kV輸電線路應急處置預案6個
- 麗聲北極星分級繪本第三級下 The Class Trip 課件
- 第一課想聽聽我的忠告嗎
- 高英Lesson3 Pub Talk and the King27s English
- 《平方差公式(1)》導學案
評論
0/150
提交評論