In: Computer Science
Draw parse trees for nine strings in question one, using their
grammars.
For the following grammars,...
Draw parse trees for nine strings in question one, using their
grammars.
- For the following grammars, write the leftmost derivation for
the strings given with each. Next to each derivation step, write
the number of the rule used. Do not combine steps.
- grammar (3 rules), Σ = {a, b}:
S -> aSbS | bSaS | ε
strings (3): ab, baab, bbaa
- grammar (6 rules), Σ = {0, 1}:
S -> A1B
A -> 0A | ε
B -> 0B | 1B | ε
strings (3): 1, 0011, 01010
- grammar (6 rules), Σ = { +, x, a, (, ) }
E -> E + T | T
T -> T x F | F
F -> (E) | a
strings (3): a, a x a, (a) + a x
a,
- grammar (4 rules), Σ = {(, ), [, ]}:
S -> (S) | [S] | SS | ε
strings (3): ( ), [ ] ( ), ( [ ]
)