简体   繁体   English

简化CFG:S -> SS | (S) | ε

[英]Simplifying CFG: S -> SS | (S) | ε

Is it possible to simplify even more the next CFG?下一个 CFG 是否可以进一步简化?

S -> SS | (S) | ε

I've removed all the other null and unit productions, but I believe it is possible to simplify it even more.我已经删除了所有其他的 null 和 unit 产生式,但我相信可以进一步简化它。

How about怎么样

S -> (S)S | ε

Does that cover all the bits of the original?这是否涵盖了原始内容的所有部分?

S -> (S) is covered by the second S being ε S -> (S) 被第二个 S 覆盖,即 ε

S -> SS is either two ε, check; S -> SS 要么是两个 ε,检查; or contains at least one pair of parens, check或至少包含一对括号,检查

Yes, that looks about right.是的,这看起来是对的。 You can choose whether you like (S)S or S(S) better, should work the same.你可以选择你更喜欢 (S)S 还是 S(S),应该是一样的。

Note: not very authoritative, I have only a vague idea what I'm talking about注意:不是很权威,我只有一个模糊的想法我在说什么

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM