Ideas Solution
Q No 01
Solution:
NP -> Adj NP
The draw parse trees for above given grammar:
3ed24217-a089-4cd3-85e7-56389d10ccf9-image.png
The above given grammar have only one parse tree so it is non-ambiguous grammar.
NP -> NP Conj NP
The draw parse trees for above given grammar:
1c473269-1c88-4ba5-84d6-ab5169f94657-image.png
The above grammar has two different parse trees therefore the given grammar is ambiguous.
NP -> Adj N
The draw parse trees for above given grammar:
ee704f9a-b021-483a-864b-b72abc0a1c4a-image.png
The above given grammar have only one parse tree so it is non-ambiguous grammar.
NP ->N
The draw parse trees for above given grammar:
fe99c1ab-1959-4c17-b112-e347d177268b-image.png
The above given grammar have only one parse tree so it is non-ambiguous grammar.
Adj -> Young
The draw parse trees for above given grammar:
3bfc0b07-1dc1-4f40-ace6-49718f09b14f-image.png
The above given grammar have only one parse tree so it is non-ambiguous grammar.
Conj -> and
The draw parse trees for above given grammar:
bb56b34a-9ec9-4499-bd8e-d0b877b19b93-image.png
The above given grammar have only one parse tree so it is non-ambiguous grammar.
N -> Boys | Girls
The draw parse trees for above given grammar:
68e9888e-bc35-4ba4-9f60-2c46a8fa81f5-image.png
The above given grammar have only one parse tree so it is non-ambiguous grammar.
Q No 02
Solution:
The given grammar is
S -> S + S | S / S | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19
The draw parse trees for above given grammar:
Parse Trees:
a4b787fc-27a6-401d-ab7a-5b97e4399d99-image.png
The above grammar has two different parse trees therefore the given grammar is ambiguous.
THE END!