You are on page 1of 4

What is the forward reference problem? Explain single pass assembler with flowchart.

Explain multi pass assembler in detail

Show machine code generated for following assembly level program along with data structures entries

Explain single pass macro processor

Explain the working of macro processor along with the data structures used in it

Explain the working of DLL loader in detail.

Draw and Explain the various phases of compilers with suitable example.

Modify the given grammar and construct a Predictive parser table explaining each step.
E->E+T|T T->T*V|V V-> id.

For a given grammar below, Construct operator precdence relation matrix, assuming *, + are binary
operators and 'id' is terminal symbol, and E as Non terminal.
E->E+E E->E*E E->id Apply operator precedence parsing algorithm for the statement ' id + id * id'

Consider the following grammar: S --> aSbS | bSaS | Epcillon.


1. Frame the transition table and action / goto table of the given grammar.
2. Demonstrate if the grammar is LR(0) or not.

Explain the working of shift reduce parser along with suitable example

Explain the different forms of intermediate codes used by Compiler.

What is code optimization? Explain machine dependent code optimisation techniques with suitable
example

Explain machine independent code optimization techniques with suitable example

Discuss various issues that occur in the code generation phase of the compiler.

Explain the difference between Compiler and Interpreter

Define the various system softwares used in compilers

What is the need of system softwares?

Explain various data structures used in assembler design

What is the need of an assembler to be multi pass?

Explain various types of statements used in assembler design

What are the different functions performed by macroprocessor?

Explain Parameterized macro with suitable example

Explain conditional macro with suitable example.

What are the different functions performed by loader

Enlist different types of noodles and explain compile and go loader in detail

Explain the working of absolute loader.

What do you mean by relocation? Explain relocating loader in detail.


Explain the difference between linking loader and linkage editor.

Explain the working of compiler phases for following expression Position = initial + rate * 60.

Explain the role of finite automata in lexical analysis

Design DFA for given finite automata. (a+b)*abb

Differentiate between top down and bottom up parser.

Define synthesized and inherited attributes used in Syntactic analysis of compiler.

Generate three address code for the following logical expression. If a<b then 1 else 0

Design quadruple and triple for following expression a=(b+c)*(d+e)

Design DAG representation for given expression. a=(a+b)*(a-c)

Explain flow graphs and basic blocks in detail.

Write a short note on LEX and YACC.


Q. What is the forward reference problem? Explain single pass assembler with
flowchart.
It is a kind of Load-and-go type of assembler that generally generates the object code directly in memory for
immediate execution! It parses through your source code only once and your done.

A one pass assembler generates code and for any undefined symbols, leaves a slot to be filled in, and remembers it in
a table or other data structure. Then where the symbol is defined, it fills in its value at the right place or places, using
the information from the table.

The reason for using a two pass assembler traditionally has been that the target program doesn't fit in memory, leave
alone the source. The gigantic source program is read, line by line, from the punch tape reader, and the table of
labels is kept in internal memory. (I've actually done that, on ISIS, the first development system of Intel, with an
8080.) The second time around the source tape is again read from the beginning, but the value of all labels is known,
and as each line is read, the target program is punched out to tape. On a memory starved 16 bit Intel 8086 system this
was still a useful technique to have a heavily documented source file that can be much larger than 64 Kbyte, with
hard disk or floppy substituted for paper tape.

Nowadays there is no need to do two passes, but this architecture is still in use. It is slightly simpler, at the expense
of I/O.

Q. Explain flow graphs and basic blocks in detail.


Basic Block

The basic block is a set of statements. The basic blocks do not have any in and out branches except entry and exit. It
means the flow of control enters at the beginning and will leave at the end without any halt. The set of instructions of
basic block executes in sequence.

Here, the first task is to partition a set of three-address code into the basic block. The new basic block always starts from
the first instruction and keep adding instructions until a jump or a label is met. If no jumps or labels are found, the
control will flow in sequence from one instruction to another.

The algorithm for the construction of basic blocks is given below:

Algorithm: Partitioning three-address code into basic blocks.

Input: The input for the basic blocks will be a sequence of three-address code.

Output: The output is a list of basic blocks with each three address statements in exactly one block.

METHOD: First, we will identify the leaders in the intermediate code. There are some rules for finding leaders, which are
given below:

The first instruction in the intermediate code will always be a leader.

The instructions that target a conditional or unconditional jump statement are termed as a leader.
Any instructions that are just after a conditional or unconditional jump statement will be a leader.

Each leader’s basic block will have all the instructions from the leader itself until the instruction, which is just before the
starting of the next leader.

Flow Graph

It is a directed graph. After partitioning an intermediate code into basic blocks, the flow of control among basic blocks is
represented by a flow graph. An edge can flow from one block X to another block Y in such a case when the Y block’s
first instruction immediately follows the X block’s last instruction. The following ways will describe the edge:

There is a conditional or unconditional jump from the end of X to the starting of Y.

Y immediately follows X in the original order of the three-address code, and X does not end in an unconditional jump.

REF:- https://www.tutorialandexample.com/basic-blocks-and-flow-graphs-compiler-design

You might also like