S1→ aS1a | bS1b | A
will the language generated by the whole grammar change? If yes, give a precise description of the new language. If no, give a clear logical argument explaining why the language will not change.
Grammar for the mentioned question is not given.
So, I'm making an assumption that there are two inputs (a&b) and A is the end node.
If we divide the given line then, it'll be
S1 -> a S1 a
S1 -> b S1 b
S1 -> A
If we observe this grammar then we can change it into
S1 -> (a+b) S1(a+b)
S1 -> A
And from this, we can conclude that this grammar is checking the length of the entered string should be greater or equal to two.
So, if we add this line into any grammar then it'll definitely change it unless it confirms that length of entered string is greater or equal to two.
Get Answers For Free
Most questions answered within 1 hours.