dragon-book-exercise-answers
dragon-book-exercise-answers copied to clipboard
Added Answers for 4.2.3 (5 & 6)
-
! The set of all strings of 0s and as in which 011 does not appear as a substring.
S -> 1S | 0T T -> 0T | 01T | ε
-
!! The set of all strings of 0s and 1s of the form xy, where x<>y and x and y are of the same length. M -> P | 0M1 | 1M0 | 1M1 | 0M0 P -> 0I0 | 1I0 I -> 0I0 | 1I1 | ε
In 5. the empty string is not accepted by this grammar I think this grammar would be better S -> 1S | 0T| ε T -> 0T | 01T | ε