[英]Context free grammar for L{a^n b^m c^t where t>0,m>0,n>2}
For a context free grammar for L{a^nb^mc^t where t>0,m>0,n>2}
对于L{a^nb^mc^t where t>0,m>0,n>2}
的上下文无关文法
S -> ABC
A ->aB|a
B ->bB|b
C ->cC|c
Is this correct?这个对吗?
This is incorrect.这是不正确的。 Your current grammar would allow the solution abc
which is not part of your grammar since a
does not appear more than two times.您当前的语法将允许解决方案abc
不属于您的语法,因为a
出现的次数不超过两次。
It can be constructed the following way:它可以通过以下方式构建:
S -> ABC -> aBC -> abC -> abc
I would suggest the following grammar:我建议使用以下语法:
S -> aaABC
A -> aA|a
B -> bB|b
C -> cC|c
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.