MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

COMPILER DESIGN

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: -The LR (0) item for Grammar G consists of a production in which symbol dot (.) is inserted at some position in R.H.S of production. Canonical LR (0) collection helps to construct LR parser called Simple LR (SLR) parser.

Detailed explanation-3: -In computer science, a canonical LR parser or LR(1) parser is an LR(k) parser for k=1, i.e. with a single lookahead terminal. The special attribute of this parser is that any LR(k) grammar with k>1 can be transformed into an LR(1) grammar.

Detailed explanation-4: -Explanation: GOTO is a function that is called for defining the DFA. And, it is called the canonical collection of LR(0) item.

Detailed explanation-5: -CLR refers to canonical lookahead. CLR parsing use the canonical collection of LR (1) items to build the CLR (1) parsing table. CLR (1) parsing table produces the more number of states as compare to the SLR (1) parsing. In the CLR (1), we place the reduce node only in the lookahead symbols.

There is 1 question to complete.