Question: Draw a parse tree. Grammar S - > ab | aSb Specifially for these phrases: 1 . aabb 2 . aaaabbbb The logic here is

Draw a parse tree.
Grammar S-> ab | aSb
Specifially for these phrases:
1. aabb
2. aaaabbbb
The logic here is the quantity of "a" is equal to the number of "b"
hence:
aabb
S-> aSb -> aabb
aaaabbbb
S-> aSb -> aaSbb-> aaaSbbb->aaaabbbb (adding a & b for each iteration until it matches the phrase, removing the S symbol).
tl;dr
I need the drawings of the parse trees of
aabb
&
aaaabbbb
Using the grammar:
S-> ab | aSb

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!