简体   繁体   中英

Equivalent balanced parentheses grammars

I have these 2 unambiguous grammars for balanced parentheses.

S -> S(S) | epsilon 

and

S -> (S)S | epsilon

Are they equivalent? I have been trying some random inputs and I think they are, but I'm not sure if there is a case where one cannot reads a certain input.

它们识别相同的语言,但生成不同的解析树。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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