看板 Prob_Solve 關於我們 聯絡資訊
這個問題我一直想不透. 痛苦極了啊~~ Orz (抓頭) 問題如下: Assume G is an LR(0) grammar. Let F --> ε be a production that is not currently in G. Assume F is a nonterminal that is already in G. Let G* be the new grammar obtained from G by inserting the new production F --> ε. Describe the possible impacts (in the areas of conflicts, expressive power and parsing complexities) of adding this new production. ========= 痛苦分隔線 =============== 我怎麼想都覺得不會有影響啊 (哭) 舉例來說, 若原本的 grammar: E' --> E E --> E + T T --> T * F F --> (E) | id 加了 ε的 grammar: (舉例來說) E' --> E E --> E + T | ε T --> T * F F --> (E) | id 則最後的 LR(0) sets 也不會變啊. 有誰知道到底有什麼影響嗎? Orz 頭髮都快抓光了 (繼續抓頭.. Q_Q) 大感謝 Orz -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 218.160.33.61
Eventis:我很好奇耶,如果E,T這兩條都沒ε 06/28 08:45
Eventis:要怎麼parse出id@@? 06/28 08:45
Eventis:i.e. E'就只是一個id,沒有什麼加減乘除 06/28 08:46
Eventis:或者,把原來的T->T*F拿掉,F->(E)|id換成T->(E)|id 06/28 08:47
Eventis:那個ε很讓人又愛又恨的啊0.0 06/28 08:48