Consider the language $L=\{w \in \{a,b\}^+ \mid w\text{ contains }aa \text{ followed by }bb\}$.
I wanted to know if this grammar is correct or not.
This is my solution:
$S\to IaabbI.$
$I\to aI|bI|e.$
Consider the language $L=\{w \in \{a,b\}^+ \mid w\text{ contains }aa \text{ followed by }bb\}$.
I wanted to know if this grammar is correct or not.
This is my solution:
$S\to IaabbI.$
$I\to aI|bI|e.$
In my opinion the definition "$w$ contains $aa$ followed by $bb$" is somewhat ambiguous: Does it mean,
According to the first interpretation, your grammar is correct.
According to the second interpretation, we should use the rule $S\to IaaIbbI$ instead.