Question: Find the total number of derivation trees to derive the string "abc"…
Question: Find the total number of derivation trees to derive the string "abc" for the following grammar.
S → SS | (S) | a | b | c | abc
Answer: 3 — String "abc" can be generated with 3 different parse trees. 1) LMD1: S → abc 2) LMD2: S → SS → aS → aSS → abS → abc 3) LMD3: S → SS → SSS → aSS → abS → abc
Attempted by 47 students.
Show answer & explanation
Correct answer: 3
String "abc" can be generated with 3 different parse trees.
1) LMD1: S → abc
2) LMD2: S → SS → aS → aSS → abS → abc
3) LMD3: S → SS → SSS → aSS → abS → abc
Loading lesson…