作者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
1F:→ MOONRAKER:阿又不是一定会加在这种没妨碍的地方 59.115.223.48 06/27 20:14
2F:→ MOONRAKER:有的地方会有影响,别的地方则否 59.115.223.48 06/27 20:15
3F:→ MOONRAKER:各有不同,你应该分项讨论,这就是重点 59.115.223.48 06/27 20:15
4F:→ opman:也许,可改抓 胡子,手毛,耳朵,鼻子或肚皮之类 219.80.132.184 06/28 16:07
5F:→ opman:就不用担心提早 聪明绝顶. 219.80.132.184 06/28 16:08