作者itchy (Lucky we love you.)
看板Programming
標題[請益] 有 Compiler 達人嗎? Orz
時間Fri Jun 27 19:20:50 2008
這個問題我一直想不透. 痛苦極了啊~~ 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
→ MOONRAKER:阿又不是一定會加在這種沒妨礙的地方 59.115.223.48 06/27 20:14
→ MOONRAKER:有的地方會有影響,別的地方則否 59.115.223.48 06/27 20:15
→ MOONRAKER:各有不同,你應該分項討論,這就是重點 59.115.223.48 06/27 20:15
→ opman:也許,可改抓 鬍子,手毛,耳朵,鼻子或肚皮之類 219.80.132.184 06/28 16:07
→ opman:就不用擔心提早 聰明絕頂. 219.80.132.184 06/28 16:08