ascii table 4 ASCII Code Set l l




ascii table 4

基本定義 ¡ ASCII Code Set l l American Standard Code for Information Interchange 的縮寫 標準的 ASCII Code 有7個位元 ¡ l l 可表示 27 = 128 種不同的字元 一般使用在 IBM PC 及Apple II上 現今使用的 ASCII Code 已經擴充為 8個位 元,稱之為 ASCII-8 5

基本定義 EBCDIC Code Set ¡ Extended Binary Code Decimal Interchange Code 的縮寫 ¡ 標準的EBCDIC Code有8個位元 ¡ l ¡ 可表示 28=256 種不同的字元 一般使用在IBM 360及FACOM機器上 6









基本定義 ¡ L+ 的定義 l l 又稱為“Transitive Closure of L” L+=L 1 L 2 L 3. . . Ln. . . 15



文法的分類 ¡ Type 0 l ¡ Type 1 l ¡ Context sensitive grammar Type 2 l ¡ 無任何限制 Context free grammar Type 3 l 正規文法 (regular grammar) 18


B. N. F. 文法 ¡ B. N. F. grammar l l l Backus Naur Form grammar type 2 grammar context-free grammar 20


範例 ¡ Using the following B. N. F. grammar to construct a parse tree for the statement below A: =B DIV 10 + C×D l <assign>: : =id: =<exp> l <exp>: : =<term>∣<exp>+<term>∣<exp>-<term> l l <term>: : =<factor>∣<term>×<factor >∣<term> DIV <factor>: : =id∣int∣(<exp>) 22

推導過程 ¡ <assign> : : = id : = <exp> + <term> : = <term> DIV <factor> + <term> : = <factor> DIV <factor> + <term> : = id DIV int + <term> : =id DIV int + <term> * <factor> : =id DIV int + <factor> * <factor> : = id DIV int + id * id 23




模擬兩可的文法 ¡ Draw 2 different parse tree for id+id+id, using the grammar E→E+E∣id 對id+id+id可畫出二個不同的剖析樹如下 故此文法是模擬兩可的 27

模擬兩可的文法 ¡ Is the following grammar ambiguous? Describe your response carefully? S→a. Sb. S∣b. Sa. S∣ε 如 abab 1. S a 2. S b S ε b a S ε S S a S ε b S a S b S ε ε 28









語意的描述 semantics) ¡ 動態語意(dynamic semantics) ¡ 靜態語意(static l l l 解釋型語意(interpretive semantics) 公理型語意(axiomatic semantics) 符號型語意(denotational semantics) 37


動態語意 解釋型語意(interpretive semantics) ¡ 公理型語意(axiomatic semantics) ¡ 符號型語意(denotational semantics) ¡ 39




- Slides: 43