Professional Documents
Culture Documents
IN
[Year]
UNIT IV
SYNTAX DIRECTED DEFINTION & RUN TIME MEMORY
TWO MARK WITH ANSWERS
CSEITQUESTIONS.BLOGSPOT.IN
[Year]
CSEITQUESTIONS.BLOGSPOT.IN
[Year]
CSEITQUESTIONS.BLOGSPOT.IN
[Year]
CSEITQUESTIONS.BLOGSPOT.IN
[Year]
Product.
If T1 e T2 are type expressions, then their Cartesian
Product
T1 T2 is a type expression;
(c) Record.
Similar to Product but with names for different fields
(used toaccess the components of a record). Example
of a C record type:
struct
{ double r;
int i;
}
(d) Pointer.
If T is a type expression, then pointer(T) is the type
expression pointer to an object of type T ;
(e)
Function.
If D is the domain and R the range of the function then
we
denote its type by the type expression: D : R.
The mod operator has type, int int : int. The Pascal
function:
function f(a, b: char): int
has type:
char char : int
10.Define Type System.
Type System: Collection of rules for assigning type
expressions to the
various part of a program.
CSEITQUESTIONS.BLOGSPOT.IN
[Year]
Inherited attributes
An inherited attribute for
nonterminal B at a parse tree node
N is defined
A semantic rule associated with
the production at the parent of N.
Note that the production must
have B as symbol in its body.
An Inherited attribute at node N is
defined only interms of attribute
values at
N parent,
Nitself,
N siblings
CSEITQUESTIONS.BLOGSPOT.IN
[Year]
13.L-attributed SDT.
This form od SDT uses both synthesized and inherited
attributes with restriction of not taking values from right
siblings.
In L-attributed SDTs a non terminal can get values from its
parent,child, and siblings.
EX:S ABC
S can take values from A,B,C
A can take values from S only
B can take values from S & A
C can take values from S,A,B
No non terminal can get values rom siblings to its right.
Attributes in L attributed SDTs are evaluated by depth first
and left to right parsing manner.
CSEITQUESTIONS.BLOGSPOT.IN
[Year]
Translation Scheme
Syntax Directed Definition:
Give high level specification for translation.
Hide many implementation details such as order of
evalution of semantic actions.
We associates a production rules with a set of semantic
actions and we do not say when they will be evaluated.
Translation scheme:
Indicate the order of evalution of semantic actions
associated with a production rule.
In other words, translation schemes give a little bit
information about implementation details.
15.Generalize the limitations of the static memory allocation?
size of data objects,as well as any constraints on their
positions in memory, must be available at compile time.
No recursion because all activations of a given procedure use
the same bindings for local names.
No dynamic data structures since no mechanism is provided
for runtime storage allocation.
If we declare more static data space than we need waste
space.
16.The Strategies of storage allocation.
The various storage allocation strategies to allocate storage in
different data areas of memorys are:
Static allocation:
Storage is allocated for all data objects it compile time.
Stack allocation:
The storage is managed as a stack
Heap allocation:(It is one of Dynamic storage allocation)
CSEITQUESTIONS.BLOGSPOT.IN
[Year]
CSEITQUESTIONS.BLOGSPOT.IN
[Year]
20.Activation tree.
The activation tree depends on runtime behaviour.
The activation tree may be different for every program
output.
Since activation tree probably nested a stack can track
currently activate procedures.
We can use a tree to show way control enters and leave
activations.
Each node represents an activation of a procedure.
The root represents the activations of the main program.
The node is a parent of the node b if the control flow a to b.
21.Activation record.
Whenever a procedure is executed, its activation record is
stored on the stack, also known as control stack.
When a procedure calls another procedure, the execution
of the caller is suspended until the called procedure
finishes execution.
CSEITQUESTIONS.BLOGSPOT.IN
[Year]