0

Language X = { 0^m such that m = 2n+1 where n >= 0}

Can someone help me find the context sensitive grammar for X? Ive been trying for ages but im still not close.

What i have right now:

S -> B0C|00

B0 -> DD0|00

BD -> DD

0C -> 0EE|00

EC -> EE

D -> B

E -> C

But this doesn't work. I can't figure out how to double the number of zeros.

1 Answer 1

1

Why not just use a simple grammar (even context-free in this case, though I can also make one that isn't), such as:

S -> 0 | 00S 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.