简体   繁体   English

简化无上下文语法

[英]Simplification of a context free grammar

Given the context-free grammar G = ( {S, A, B, C} , {0, 1} , P , S) , where the set of productions P is: 给定无上下文语法G = ( {S, A, B, C} , {0, 1} , P , S) ,其中产生的集合P是:

S → 0A0 | 1B1 | BB
A → C
B → S | A
C → S | λ

I am supposed to remove the useless symbols. 我应该删除无用的符号。

My questions is should I consider the empty string λ a terminal here while applying the algorithm where I create a new set V' containing symbols resulting in direct derivations then adding to V' symbols that produce a combination of terminals and variables in V' . 我的问题是我应该考虑空字符串λ终端这里同时应用,我创建了一组新的算法V'含有造成直接推导,然后添加到符号V'产生终端和变量的组合,符号V' Any guidance is appreciated, Thanks 任何指导表示赞赏,谢谢

λ is not a terminal, and you should not make it one. λ不是终端,你不应该把它做成一个终端。 It is, however, a (trivial) "combination of terminals and non-terminals". 然而,它是(微不足道的)“终端和非终端的组合”。

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

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