Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does Backpatching mean?

What does backpatching mean ? Please illustrate with a simple example.

like image 498
saplingPro Avatar asked Apr 13 '13 05:04

saplingPro


People also ask

What are the functions of Backpatching?

Backpatching technique is incorporated using three functions. Makelist(), merge() and backpatch() are the three functions carried out in two passes to generate code using backpatching.

How Backpatching can be used to generate the code for boolean expression?

What is Backpatching of Boolean Expressions and Control Statements in compiler design? The simplest way to execute syntax-directed translation is to use two passes. First, construct a syntax tree for the input and then walk the tree in depth-first order, completing the translations given in definition.

What is the objective of intermediate code generation?

Intermediate code eliminates the need of a new full compiler for every unique machine by keeping the analysis portion same for all the compilers. The second part of compiler, synthesis, is changed according to the target machine.

What is Boolean expression in compiler design?

Boolean means True or False. It can also be represented by 1 or 0. Here a > b is a conditional expression that can be either True or False. These are expressions that contain logical operators, i.e., OR, AND, NOT applied on operands.


2 Answers

Back patching usually refers to the process of resolving forward branches that have been planted in the code, e.g. at 'if' statements, when the value of the target becomes known, e.g. when the closing brace or matching 'else' is encountered.

like image 143
user207421 Avatar answered Oct 02 '22 17:10

user207421


In intermediate code generation stage of a compiler we often need to execute "jump" instructions to places in the code that don't exist yet. To deal with this type of cases a target label is inserted for that instruction. A marker nonterminal in the production rule causes the semantic action to pick up.

like image 22
Mostafiz Rahman Avatar answered Oct 02 '22 15:10

Mostafiz Rahman