-1

I want to match strings that contain "k" number of 0's followed by "k+4" number of 1's where k is greater than or equal to zero

I tried the following grammar is this correct?

S->0S1|1111
mike
  • 49
  • 1
  • 8

1 Answers1

1

Yes, this is correct. Though one would say that the grammar generates the strings, not match.

Peter Leupold
  • 1,162
  • 1
  • 9
  • 16