• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content

Loading…

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

Like this presentation? Why not share!

Compiler design

on

  • 2,133 views

 

Statistics

Views

Total Views
2,133
Views on SlideShare
2,133
Embed Views
0

Actions

Likes
0
Downloads
53
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Compiler design Compiler design Presentation Transcript

    • 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 objects is managed by the run-time support package
      • The representation of data objects at run-time is determined by its type
    • 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
    • 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
    • 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
    • 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
    • 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
    • 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
    • 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
    • Thank you
      Shashwat Shriparv
      dwivedishashwat@gmail.com
      InfinitySoft