COMPILER DESIGN

SYNTAX ANALYSIS

ROLE OF THE PARSER

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Which phenomenon happens when the non-terminal on the left side is repeated as the first symbol on the right side?
A
Left-most derivation
B
Left recursion
C
Left factoring
D
Left parsing
Explanation: 

Detailed explanation-1: -The production is left-recursive if the left most symbol on the right side is the same as the non-terminal on the left side.

Detailed explanation-2: -Left recursion: when one or more productions can be reached from themselves with no tokens consumed in-between. Left factoring: a process of transformation, turning the grammar from a left-recursive form to an equivalent non-left-recursive form.

Detailed explanation-3: -Explanation: The leftmost derivation is that derivation of context-free grammar which replaces the leftmost non-terminal symbol at each step.

Detailed explanation-4: -With right recursion, no reduction takes place until the entire list of elements has been read; with left recursion, a reduction takes place as each new list element is encountered. Left recursion can therefore save a lot of stack space.

Detailed explanation-5: -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.

There is 1 question to complete.