Hello! I found some problem with CNF. After translating my CNF grammar to text I tried to read it from text again, but got another grammar...
cfg = CFG.from_text("S -> a S b | a b")
cnf = cfg.to_normal_form()
cnf.contains([Terminal("a"),Terminal("b")])
True
new_text = cnf.to_text()
new_cnf = CFG.from_text(new_text)
new_cnf.contains([Terminal("a"), Terminal("b")])
False
Can you fix this please?
P.S. I think it might be happening because of wrong translation of variables (creating variables with lowercase first letter from terminals (a#CNF# -> Terminal(a))
Hello! I found some problem with CNF. After translating my CNF grammar to text I tried to read it from text again, but got another grammar...
Can you fix this please?
P.S. I think it might be happening because of wrong translation of variables (creating variables with lowercase first letter from terminals (a#CNF# -> Terminal(a))