Chomsky Normal Form for Integer Recognition

163 Views Asked by At

If I have the following CFG, which is just the regex [0-9]+:

STATEMENT -> NUMBER
NUMBER -> NUMBER DIGIT
NUMBER -> DIGIT
DIGIT -> 0|1|2|3|4|5|6|7|8|9

How do I turn it into Chomskey Normal Form? It seems like its going to be impossible without using a NUMBER -> epsilon rule.

Thanks!

1

There are 1 best solutions below

0
On BEST ANSWER

The Chomsky normal form for the grammar is:

STATEMENT -> NUMBER
NUMBER -> NUMBER NUMBER
NUMBER -> 0|1|2|3|4|5|6|7|8|9

I don't know why this didn't occur to me earlier.