作者itchy (Lucky we love you.)
看板Prob_Solve
标题[请益] 有 compiler 达人吗? Orz
时间Fri Jun 27 19:18:55 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:推 Eventis:我很好奇耶,如果E,T这两条都没ε 06/28 08:45
2F:→ Eventis:要怎麽parse出id@@? 06/28 08:45
3F:→ Eventis:i.e. E'就只是一个id,没有什麽加减乘除 06/28 08:46
4F:→ Eventis:或者,把原来的T->T*F拿掉,F->(E)|id换成T->(E)|id 06/28 08:47
5F:→ Eventis:那个ε很让人又爱又恨的啊0.0 06/28 08:48