简体   繁体   中英

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:

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' . 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".

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