程式語言考古題 - 考試

By Leila 
at 2015-02-25T19:45
at 2015-02-25T19:45
Table of Contents
http://wwwc.moex.gov.tw/ExamQuesFiles/Question/094/035335200.pdf 
 
第四題~寫出字串所有的剖析樹
 
字串 if a then if b then goto x else if c then goto y else goto z
 
我簡化一下 if(1) if(2) else(A) if(3) else(B)
 
我的參考書是2013胡世雄的程式語言 他只畫了兩棵樹
 
第一組 2搭A和3搭B
 
第二組 1搭A和3搭B
 
但我自己可以畫出第三組 1搭B和2搭A
 
<stm>
 
<if stm>
(1) (B)
if <bexp> then <stm> else <stm>
| | |
a <if stm> goto z
| | | | | |
if <bexp> then <stm> else <stm>
(2) | | (A) |
b goto x <if stm>
| | | |
if <bexp> then <stm>
| |
c goto y
 
http://wwwc.moex.gov.tw/ExamQuesFiles/Question/100/100060_34430.pdf
 
第六題的第一小題 要寫出符合語法且長度不超過3的所有句子
 
書上給的答案是 a,#a,a!a,a@a 但為什麼##a不行?
 
因為是一元運算子?但符合語法不是嗎?
 
感謝解答
 
--
    第四題~寫出字串所有的剖析樹
字串 if a then if b then goto x else if c then goto y else goto z
我簡化一下 if(1) if(2) else(A) if(3) else(B)
我的參考書是2013胡世雄的程式語言 他只畫了兩棵樹
第一組 2搭A和3搭B
第二組 1搭A和3搭B
但我自己可以畫出第三組 1搭B和2搭A
<stm>
<if stm>
(1) (B)
if <bexp> then <stm> else <stm>
| | |
a <if stm> goto z
| | | | | |
if <bexp> then <stm> else <stm>
(2) | | (A) |
b goto x <if stm>
| | | |
if <bexp> then <stm>
| |
c goto y
http://wwwc.moex.gov.tw/ExamQuesFiles/Question/100/100060_34430.pdf
第六題的第一小題 要寫出符合語法且長度不超過3的所有句子
書上給的答案是 a,#a,a!a,a@a 但為什麼##a不行?
因為是一元運算子?但符合語法不是嗎?
感謝解答
--
Tags:
        考試
        
All Comments

By Oscar 
at 2015-03-01T02:49
at 2015-03-01T02:49

By Una 
at 2015-03-03T12:16
at 2015-03-03T12:16

By Rosalind 
at 2015-03-07T21:28
at 2015-03-07T21:28

By Audriana 
at 2015-03-11T16:50
at 2015-03-11T16:50

By Donna 
at 2015-03-12T02:11
at 2015-03-12T02:11

By Christine 
at 2015-03-14T18:29
at 2015-03-14T18:29
Related Posts
洪亮普化有機

By Jake 
at 2015-02-25T17:29
at 2015-02-25T17:29
初等更正答案公布

By Steve 
at 2015-02-25T12:36
at 2015-02-25T12:36
放射師考題課本

By Tom 
at 2015-02-25T11:16
at 2015-02-25T11:16
自動控制題

By Tristan Cohan 
at 2015-02-25T10:54
at 2015-02-25T10:54
公家單位?

By Charlotte 
at 2015-02-25T00:25
at 2015-02-25T00:25