MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

COMPILER DESIGN

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
If Left Recursion is available, then ____ occurs.
A
stack
B
cycle
C
queue
D
symbols
Explanation: 

Detailed explanation-1: -Problem with Left Recursion: If a left recursion is present in any grammar then, during parsing in the syntax analysis part of compilation, there is a chance that the grammar will create an infinite loop. This is because, at every time of production of grammar, S will produce another S without checking any condition.

Detailed explanation-2: -A Grammar G (V, T, P, S) is left recursive if it has a production in the form. A → A |. Left Recursion can be eliminated by introducing new non-terminal A such that. This type of recursion is also called Immediate Left Recursion.

Detailed explanation-3: -Before calculating the first and follow functions, eliminate Left Recursion from the grammar, if present.

Detailed explanation-4: -Left recursion is considered to be a problematic situation for Top down parsers. Therefore, left recursion has to be eliminated from the grammar.

There is 1 question to complete.