grammar - Chomsky Normal Form Rules -
in old exam-question need convert grammar cnf, suspect provided solution wrong.
grammar:
s -> aab|a|aa|ab|abb|b|ab|bb -> aa|a|cc|c b -> bb|b|dd|d c -> cc|c d -> dd|d
in first step set variables 4 terminals:
v -> x -> b y -> c z -> d
in second step replace terminals variables(only productions in s now):
s -> vab|a|va|vb|axb|ax|xb
in third step replace ab in vab u -> ab
get:
s -> vu|a|va|vb|axb|ax|xb
in solution, don't understand what's happening s-productions abb , bb(which have set axb , xb). provided answer s-productions:
s → vu|a|va|vb|ux|b|ax|bx
how come abb set ux , bb bx? should not bb set xb @ least?
Comments
Post a Comment