CyberZHG / toolbox

https://cyberzhg.github.io/toolbox/ Encoding and parsing tools.
GNU General Public License v3.0
949 stars 81 forks source link

Result grammar is different from the original #16

Closed VascoRato closed 4 years ago

VascoRato commented 4 years ago

I gave it the simple grammar:

S -> A A | B
A -> a | ϵ
B -> b

The resulting grammar was the following:

S -> A A
   | b
A -> a
B -> b

On the original grammar, the word a was valid. On the result CNF, it is not. The CNF does not define the same language as the original CFG.

CyberZHG commented 4 years ago

Thanks. The result now becomes:

S -> A A
   | ϵ
   | b
   | a
A -> a