简体   繁体   English

CFG定义语言

[英]CFG to define a language

I need to generate a context free grammar for this language L= { a^ib^jc^k | 我需要为该语言生成上下文无关的语法L = {a ^ ib ^ jc ^ k | i, j, k ≥ 0 , i = j or i = k } i,j,k≥0,i = j或i = k}

what I already have is S : aSc | 我已经拥有的是S:aSc | T | T | abS T : bT | abS T:bT | cT | cT | ԑ ԑ

Do you guys think that the above grammar can correctly define the language? 你们认为上述语法可以正确定义语言吗? if not, is there any better suggestion? 如果没有,还有什么更好的建议吗?

No, that grammar does not correctly define the language. 不,该语法无法正确定义语言。 It accepts "bc", for instance. 例如,它接受“ bc”。

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

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