G1:
stmnt -> WHILE (ID) stmnt
stmnt-> OTHER
[S-> AS/B
B-> b ]
Language: L(G1) = (WHILE(ID))* OTHER
Regular expression: (A)*B .
Thus G1 is regular.
G2:
- Because of productions expr → expr + expr
and expr → expr * expr (non-linear),
G2 is context-free but not regular.
Answer: B