COMPILER DESIGN
RUN-TIME
ENVIRONMENTS
Shashwat Shriparv
dwivedishashwat@gmail.com
InfinitySoft
Run-time mainly deals with the actions that
must occur to implement the program
• The allocation and deallocation of
data ...
Source Language Issues
Procedures
A procedure definition is a declaration
that, in its simplest form, associates
an identi...
A Pascal pgm for reading & sorting integers
program sort(input,output);
var a : array [0…10] of integer;
procedure readarr...
Activation Trees
Assumptions about the flow of control
among procedures during the execution of
a program:
Control flows s...
Execution of a procedure body is referred
to as an activation of the procedure
The “lifetime” of an activation of a
proced...
A procedure is recursive if a new
activation can begin before an earlier
activation of the same procedure has
ended
An “ac...
In an activation tree:
Each node represents an activation of a
procedure
The root represents the activation of the
main pr...
Output suggesting the activations of procedures
enter readarray
leave readarray
enter quicksort(1,9)
enter partition(1,9)
...
Shashwat Shriparv
dwivedishashwat@gmail.com
InfinitySoft
Upcoming SlideShare
Loading in...5
×

Compiler design

1,837
-1

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
1,837
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
55
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Compiler design

  1. 1. COMPILER DESIGN RUN-TIME ENVIRONMENTS Shashwat Shriparv dwivedishashwat@gmail.com InfinitySoft
  2. 2. Run-time mainly deals with the actions that must occur to implement the program • The allocation and deallocation of data objects is managed by the run-time support package • The representation of data objects at run-time is determined by its type
  3. 3. Source Language Issues Procedures A procedure definition is a declaration that, in its simplest form, associates an identifier with a statement. identifier is the procedure name & statement is the procedure body
  4. 4. A Pascal pgm for reading & sorting integers program sort(input,output); var a : array [0…10] of integer; procedure readarray; var i: integer; begin for i := 1 to 9 do read (a[i]) end; function partition (y, z: integer) : integer; var i,j,x,v : integer; begin… end; procedure quicksort (m,n : integer); var i : integer; begin if( n > m) then begin i := partition(m,n); quicksort(m,i-1); quicksort(i+1,n); end end; begin a[0] := -9999; a[10] := 9999; readarray; quicksort(1,9) end
  5. 5. Activation Trees Assumptions about the flow of control among procedures during the execution of a program: Control flows sequentially Each execution of a procedure starts at the beginning of the procedure body and eventually returns control to the point immediately following the place where the procedure was called
  6. 6. Execution of a procedure body is referred to as an activation of the procedure The “lifetime” of an activation of a procedure is the sequence of steps b/w the first and last steps in the execution of the procedure body including the time spent for execution Lifetimes are either non-overlapping or nested
  7. 7. A procedure is recursive if a new activation can begin before an earlier activation of the same procedure has ended An “activation tree” is used to depict the way control enters and leaves activations
  8. 8. In an activation tree: Each node represents an activation of a procedure The root represents the activation of the main program The node for a is the parent of the node for b iff control flows from activation a to b The node for a is to the left of the node for b iff the lifetime of a occurs before the lifetime of b
  9. 9. Output suggesting the activations of procedures enter readarray leave readarray enter quicksort(1,9) enter partition(1,9) leave partition(1,9) enter quicksort(1,3) leave quicksort(1,3) enter quicksort(5,9) leave quicksort(5,9) leave quicksort(1,9) execution terminated
  10. 10. Shashwat Shriparv dwivedishashwat@gmail.com InfinitySoft
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×