wazzer225 0 Newbie Poster

Hi,

I was attempting to convert the following grammer into CNF

S -> XY
X -> aXb | e
Y -> aY | a

The Mark Scheme gives the following:

S -> AX | AY | a
X -> AK | AB
Y -> AY | b
A -> a
B ->b
K -> XB

But i get this:

S -> XY | AY | a
X -> AK | AB
Y -> AY | a
A -> a
B ->b
K -> XB

Where am I going wrong? I'm so confused i'm even thinking the mark scheme might be wrong.

Thanks in advance

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.