# COMPILER DESIGN

## SYNTAX ANALYSIS

### ROLE OF THE PARSER

 Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Which of the following function is called the canonical collection of LR(0) item.
 A FIRST B GOTO C COMPUTE D FOLLOW
Explanation:

Detailed explanation-1: -A collection of sets of LR (0) items is called Canonical LR(0) collection which is used in the construction of SLR functions closure and goto in order to construct canonical LR (0) collection for a grammar G. The string is accepted by the parser if and only if the reduction S’ → S takes place.

Detailed explanation-2: -An LR (0) item is a production G with dot at some position on the right side of the production. LR(0) items is useful to indicate that how much of the input has been scanned up to a given point in the process of parsing. In the LR (0), we place the reduce node in the entire row.

Detailed explanation-3: -Def: An LR(1) item is a two-component element of the form. [ A → • , ] where the first component is a marked production, A → • , called the core of the item and is a lookahead character that belongs to the set Vt ∪ .

Detailed explanation-4: -The Function GOTO If X is a grammar symbol, then moving from A→·X to A→X· signifies that the parser has just processed (input derivable from) X. The parser was in the former position and (input derivable from) X was on the input; this caused the parser to go to the latter position.

Detailed explanation-5: -An LR(0) item is a production of the grammar with exactly one dot on the right-hand side. For example, production T → T * F leads to four LR(0) items: T → ⋅ T * F.

There is 1 question to complete.