MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

COMPILER DESIGN

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Left Factoring is a transformation for factoring out the ____ prefixes.
A
odd
B
common
C
positive
D
negative
Explanation: 

Detailed explanation-1: -It is a process of factoring out the common prefixes of alternatives. It is used when it is not clear that which of the two alternatives is used to expand the non-terminal . Rewrite the given expression (1) using the 1 and 2 expressions.

Detailed explanation-2: -Left factoring transforms the grammar to make it useful for top-down parsers. In this technique, we make one production for each common prefixes and the rest of the derivation is added by new productions. Example. The above productions can be written as A => A’ A’=> | | …

Detailed explanation-3: -This kind of grammar creates a problematic situation for Top down parsers. Top down parsers can not decide which production must be chosen to parse the string in hand.

Detailed explanation-4: -Left factoring is required to eliminate non-determinism of a grammar. Suppose a grammar, S-> abS | aSb. Here, S is deriving the same terminal a in the production rule (two alternative choices for S), which follows non-determinism. We can rewrite the production to defer the decision of S as-S-> aS’

Detailed explanation-5: -Left factoring is a process by which the grammar with common prefixes is transformed to make it useful for Top down parsers. This kind of grammar creates a problematic situation for Top down parsers.

There is 1 question to complete.