retagged by
568 views
1 votes
1 votes

Which of the following is not a production of the grammar, which generated the expression 19-25+70?

  1. E $\rightarrow$ E+T
  2. E $\rightarrow$ ET $\mid$ T
  3. T $\rightarrow$ 0 $\mid$ 1 $\mid$ 2 $\mid$ 3 $\mid$ 4 $\mid$ 5 $\mid$ 6 $\mid$ 7 $\mid$ 8 $\mid$ 9 $\mid$
  4. E $\rightarrow$ E - E
retagged by

2 Answers

Best answer
7 votes
7 votes

E -> E+T cannot generate right grammer

It should be replaced by E -> E+E

otherwise right grammar generation not possible .like this

selected by
5 votes
5 votes

Every one is necessary. 

1) It will generate the Numbers.

2) Will be used for + sign, But due to this it can not generate 10+25. It has to change E-> E + E

3) It is necessary for creating 2 digit number. 

4) will be used for - sign 

Hence Answer is 2.