Question: Consider the two context - free grammars: G 1 : num - > 1 1 | 1 0 0 1 | 1 0 1 0

Consider the two context-free grammars:
G1: num ->11|1001|10101| num 0| num num
G2: num ->11|10 num01| num 0| num num
num->00 num|1 num| e
A. Prove that all strings generated by the two grammars G1 and
G2 form (unsigned) binary numbers that are multiples of 3, and
examine whether these grammars produce all strings of nonzeros
of multiples of 3 starting with 1.
B. Prove that the two grammars G1 and G2 are ambiguous and transform them into equivalent non-ambiguous grammars.
C. Consider whether the two can be converted into equivalent LL(1) grammars by eliminating the features
that make them non-LL(1), and then checking for collisions
FIRST/FIRST and FIRST/FOLLOW.
D. For either of the two final grammars in the previous question is not LL(1),
see if by looking at a second input symbol you can resolve its conflicts so that the grammar is LL(2).

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!