Computer Science Engineering (CSE) Exam  >  Computer Science Engineering (CSE) Questions  >  A grammar that is both left and right recursi... Start Learning for Free
A grammar that is both left and right recursive for a non-terminal, is
  • a)
    Ambiguous
  • b)
    Unambiguous
  • c)
    Information is not sufficient to decide whether it is ambiguous or unambiguous
  • d)
    None of the above
Correct answer is option 'C'. Can you explain this answer?
Verified Answer
A grammar that is both left and right recursive for a non-terminal, is...
Let grammar is like this :

This grammar is left as well as right recursive but still unambiguous.. A is useless production but still part of grammar..
A grammar having both left as well as right recursion may or may not be ambiguous ..
Let's take a grammar say 
Now, according to the link https://en.wikipedia.org/wiki/Formal_grammar
For a grammar G, if we have L(G) then all the strings/sentences in this language can be produced after some finite number of steps .
But, for the grammar
Can we produce any string after a finite number of steps ? NO, and hence language of this grammar is empty set {} .
Hence, If a grammar is having both left and right recursion, then grammar may or may not be ambiguous .
View all questions of this test
Most Upvoted Answer
A grammar that is both left and right recursive for a non-terminal, is...
Explanation:

When a grammar is both left and right recursive for a non-terminal, it means that there are production rules in the grammar that allow the non-terminal to appear both at the beginning and at the end of a derivation. This can lead to ambiguity in the grammar, as there may be multiple ways to derive a given string. However, it is not always the case that a left and right recursive grammar is ambiguous.

Ambiguity:

Ambiguity in a grammar means that there is more than one parse tree for a given string. When a grammar is both left and right recursive, it can lead to ambiguity because there may be multiple ways to derive a string by applying the production rules in different orders. This can result in different parse trees and therefore, different interpretations of the same string.

Unambiguity:

A grammar is unambiguous if there is only one parse tree for every string in the language. An unambiguous grammar ensures that there is no ambiguity in the interpretation of the strings derived from it.

Insufficient Information:

In this case, the question does not provide any information about the specific production rules or the non-terminal in question. Without this information, it is not possible to determine whether the grammar is ambiguous or unambiguous. Therefore, the correct answer is that the information is not sufficient to decide whether it is ambiguous or unambiguous.
Explore Courses for Computer Science Engineering (CSE) exam

Top Courses for Computer Science Engineering (CSE)

Question Description
A grammar that is both left and right recursive for a non-terminal, isa)Ambiguousb)Unambiguousc)Information is not sufficient to decide whether it is ambiguous or unambiguousd)None of the aboveCorrect answer is option 'C'. Can you explain this answer? for Computer Science Engineering (CSE) 2025 is part of Computer Science Engineering (CSE) preparation. The Question and answers have been prepared according to the Computer Science Engineering (CSE) exam syllabus. Information about A grammar that is both left and right recursive for a non-terminal, isa)Ambiguousb)Unambiguousc)Information is not sufficient to decide whether it is ambiguous or unambiguousd)None of the aboveCorrect answer is option 'C'. Can you explain this answer? covers all topics & solutions for Computer Science Engineering (CSE) 2025 Exam. Find important definitions, questions, meanings, examples, exercises and tests below for A grammar that is both left and right recursive for a non-terminal, isa)Ambiguousb)Unambiguousc)Information is not sufficient to decide whether it is ambiguous or unambiguousd)None of the aboveCorrect answer is option 'C'. Can you explain this answer?.
Solutions for A grammar that is both left and right recursive for a non-terminal, isa)Ambiguousb)Unambiguousc)Information is not sufficient to decide whether it is ambiguous or unambiguousd)None of the aboveCorrect answer is option 'C'. Can you explain this answer? in English & in Hindi are available as part of our courses for Computer Science Engineering (CSE). Download more important topics, notes, lectures and mock test series for Computer Science Engineering (CSE) Exam by signing up for free.
Here you can find the meaning of A grammar that is both left and right recursive for a non-terminal, isa)Ambiguousb)Unambiguousc)Information is not sufficient to decide whether it is ambiguous or unambiguousd)None of the aboveCorrect answer is option 'C'. Can you explain this answer? defined & explained in the simplest way possible. Besides giving the explanation of A grammar that is both left and right recursive for a non-terminal, isa)Ambiguousb)Unambiguousc)Information is not sufficient to decide whether it is ambiguous or unambiguousd)None of the aboveCorrect answer is option 'C'. Can you explain this answer?, a detailed solution for A grammar that is both left and right recursive for a non-terminal, isa)Ambiguousb)Unambiguousc)Information is not sufficient to decide whether it is ambiguous or unambiguousd)None of the aboveCorrect answer is option 'C'. Can you explain this answer? has been provided alongside types of A grammar that is both left and right recursive for a non-terminal, isa)Ambiguousb)Unambiguousc)Information is not sufficient to decide whether it is ambiguous or unambiguousd)None of the aboveCorrect answer is option 'C'. Can you explain this answer? theory, EduRev gives you an ample number of questions to practice A grammar that is both left and right recursive for a non-terminal, isa)Ambiguousb)Unambiguousc)Information is not sufficient to decide whether it is ambiguous or unambiguousd)None of the aboveCorrect answer is option 'C'. Can you explain this answer? tests, examples and also practice Computer Science Engineering (CSE) tests.
Explore Courses for Computer Science Engineering (CSE) exam

Top Courses for Computer Science Engineering (CSE)

Explore Courses
Signup for Free!
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev