简体   繁体   English

L{a^nb^mc^t where t>0,m>0,n>2} 的上下文无关文法

[英]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.

相关问题 语言L = {a ^(n)b ^(m)c ^(k)的无上下文语法:m = | i-k |} - Context-free grammar for the language L = {a^(n)b^(m)c^(k): m = |i - k|} a ^ nb ^ m的上下文无关文法 - context free grammar for a^n b^m L = {b ^ nc ^ na ^ n,n&gt; = 1}的上下文无关文法 - Context-free grammar for L = { b^n c^n a^n , n>=1} {a*b*c*} 的上下文无关文法 - {a^nb^nc^n | n &gt;=0} - Context free grammar for {a*b*c*} - {a^n b^n c^n | n >=0} L={ a^nb^m: n &lt;= m+3, n,m&gt;=0} 的 CFG - CFG for L={ a^n b^m : n <= m+3 , n,m>=0} L = {a ^ nb ^ nc ^ md ^ m:n&gt; = 1,m&gt; = 1} U {a ^ nb ^ mc ^ md ^ n:n&gt; = 1,m&gt; = 1} isRegular? - L = { a^n b^n c^m d^m : n >= 1, m >= 1 } U { a^n b^m c^m d^n : n >= 1, m >= 1 } isRegular? Prolog程序识别上下文无关文法a ^ nb ^ n - Prolog program to recognize context free grammar a^n b^n CFG for a^nb^3m c d^mef^2n 与 m, n &gt; 0 - CFG for a^n b^3m c d^m e f^2n with m, n > 0 这种与上下文无关的语法是模棱两可的,我不确定为什么。 我正在构建的SLR(1)编译器无法正常运行 - This context-free grammar is ambiguous and I'm not sure why. The SLR(1) compiler I'm building doesn't work the way I expect it to 是 L = {a^mb^nc^k | if (m=n) then (n=k) } CFL 与否? - Is L = {a^mb^nc^k | if (m=n) then (n=k) } CFL or not?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM