MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

COMPILER DESIGN

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
When code is generated for “a < b and c > d", the locations left for backpatching are
A
falselist of a < b
B
falselist of a < b and falselist of c > d
C
falselist of a < b, falselist of c > d, truelist of c > d
D
truelist of a < b, falselist of a < b, truelist of c > d, falselist of c > d
Explanation: 

Detailed explanation-1: -Backpatching is basically a process of fulfilling unspecified information. This information is of labels. It basically uses the appropriate semantic actions during the process of code generation. It may indicate the address of the Label in goto statements while producing TACs for the given expressions.

Detailed explanation-2: -One-pass code generation using backpatching Backpatching can be used to generate a program for boolean expressions and the flow of control statements in one pass. In this, synthesized attributes truelist and falselist of non-terminal B are used to handle labels in jumping code for Boolean expressions.

Detailed explanation-3: -26.2Functions to incorporate backpatching Makelist(), merge() and backpatch() are the three functions carried out in two passes to generate code using backpatching. makelist(i) – This is used to create a new list containing three-address location i, and it returns a pointer to the list.

Detailed explanation-4: -In computing, code generation is part of the process chain of a compiler and converts intermediate representation of source code into a form (e.g., machine code) that can be readily executed by the target system. Sophisticated compilers typically perform multiple passes over various intermediate forms.

There is 1 question to complete.