Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

GATE | GATE-CS-2005 | Question 14

  • Last Updated : 11 Apr, 2018

The grammar A → AA | (A) | ε is not suitable for predictive-parsing because the grammar is
(A) ambiguous
(B) left-recursive
(C) right-recursive
(D) an operator-grammar

Answer: (A)

Explanation: Since given grammar can have infinite parse trees for string ‘ε’, so grammar is ambiguous, and also A → AA has left recusion.

For predictive-parsing, grammar should be:

Attention reader! Don’t stop learning now.  Practice GATE exam well before the actual exam with the subject-wise and overall quizzes available in GATE Test Series Course.

Learn all GATE CS concepts with Free Live Classes on our youtube channel.

  • Free from ambiguity
  • Free from left recursion
  • Free from left factoring

Given grammar contains both ambiguity and left factoring, so it can not have predictive parser.
We always expect first grammar free from ambiguity for parsing. Option (A) is more strong option than option (B) here.

Quiz of this Question

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!