問題詳情

四、考慮下列的 BNF 法則:


【題組】
⑴假設 C1 和 C2 是由 〈condition〉 展開的程式碼,S1 和 S2 是由 〈statement〉 展開
的程式碼,畫出 〈conditional statement〉:
if C1 then if C2 then S1 else S2
的語法樹(或稱剖析樹,parse tree),並解釋何謂「搖擺 else 問題」(dangling
else problem)。(10 分)

參考答案