Compiler Design

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 144

POPULAR PUBLICATIONS

3. Discuss the concepts of parameter pass mechanisms. [WBUT 2019)


Answer:
The communication medium among procedures is known as paramc\er passing. The
values of the variables from a calling procedure ar.c transferred to the called procedure. by
some mechanism.
Basic Terminology:
1. R- value: The value of an expression is called its r-value. The value contained in a
single �ariable also becomes an r-value if its appear on the right side of the assignment
operator. R-value can always be assigned to some other variabl�.
2. L-value: The location of the memory (address) where the expression is stored is
known as the I-value of that expression. It always appears• on the left side if the
assignment operator.

Formal Parameters:
Variables that take the information passed by the caller procedure are called formal
parameters. These variables are declared in the definition of the called function.

Actual Parameters: . . .
Variables whose values or addresses are being passed to the called procedure are called
actual parameters. These variables are speeified in the function call as arguments.
fun_one()
{
int actual_parameter = 10;
call fun_two(int actual_parameter);
}
fun_two(int formal_parameter)
.{ ..:.,: .
prin�·{ormal_parameter;
} . . .
Formal parameters hold the information of the actual parameter, depending -upon the
parameter passing technique used. It may be a value or an address.

4. Write Short Note on following:


a) Symbol table organization [WBUT 2006, 2007, 2016)
OR,
Symbol Table · (WBUT 2009, 2010, 2011, 2012, 2013, 2015, 2018)
OR,
Symbol table manager [WBUT 2019)
b) Activation record. (WBUT 2010, 2011, 2018)
Answer:
a) Symbol table organization:
A symbol table is· a data structure, where information about program objects is gathered.
It is used in both the lexical analysis and code generation phases. The symbol table is
built up during the lexical (and partially during) syntactic analysis. It provides help for
other phases during compilation like during Semantic analysis in resolving type conflict,

CMD-100

You might also like