n see that the following given grammar is actually unacceptable for a predictive parser, or for a LL(1) parser because it is not clear how to predict for the expression E. So, we need to do something that’s called left factoring the g
We can see that the following given grammar is actually unacceptable for a predictive parser, or for a LL(1) parser because it is not clear how to predict for the expression E. So, we need to do something that’s called left factoring the grammar. So, please choose the alternative that correctly left factors “if” statement in the given grammar.
E → if C then {E}
| if C then {E} else {E}
C → true | false
Group of answer choices
1- E → if true then {E}
| if false then {E}
| if true then {E} else {E}
| if false then {E} else {E}
2- E → if C E’
E’→ then {E}
| then {E} else {E}
3- E → E’ | E’ else{E}
E’ → if C then {E}
C → true | false
4- E → if C then {E} E’
E’ → else {E} | ɛ
C → true | false
Trending now
This is a popular solution!
Step by step
Solved in 2 steps