Professional Documents
Culture Documents
Title Page
CS432F/CSL 728: JJ II
Compiler Design J I
July 2004
Page 1 of 100
S. Arun-Kumar Go Back
sak@cse.iitd.ernet.in
Department of Computer Science and Engineering Full Screen
Contd . . .
Quit
. . . Contd JJ II
IR: Properties
Go Back
Typical Instruction Set
IR: Generation
Full Screen
Quit
Title Page
JJ II
J I
Page 4 of 100
Go Back
Full Screen
Close
Quit
J I
Page 5 of 100
Go Back
Full Screen
Close
Quit
Page 6 of 100
Go Back
Full Screen
Close
Quit
Go Back
Full Screen
Close
Quit
Full Screen
Close
Quit
Quit
target code
Quit
target code
Quit
Title Page
stream of
characters
SCANNER JJ II
stream of
tokens
PARSER
parse tree J I
ERROR SEMANTIC ANALYZER SYMBOL
abstract
HANDLER TABLE
syntax tree
MANAGER
I.R. CODE GENERATOR Page 12 of 100
intermediate
representation
OPTIMIZER
optimized Go Back
intermediate
representation
CODE GENERATOR
Quit
Title Page
JJ II
J I
Page 13 of 100
Go Back
Full Screen
Close
Quit
JJ II
Page 14 of 100
Keeps track of line numbers and column numbers and Full Screen
passes them as parameters to the other phases to en-
able error-reporting to the user.
Close
Quit
Examples of lexemes.
Go Back
preprocessor directives
Close
Quit
Examples of tokens.
J I
Reserved words (e.g. begin, end, struct, if etc.)
Keywords (integer, true etc.) Page 16 of 100
rameter names)
Literal constants (numeric, string, character con- Full Screen
stants etc.)
Punctuation marks (:, , etc.) Close
Quit
Scanning: 4
Title Page
JJ II
Identification of tokens is usually done by a Determinis-
tic Finite-state automaton (DFA). J I
The set of tokens of a language is represented by a
large regular expression. Page 17 of 100
Quit
Title Page
ae,gz
identifier if identifier
f JJ II
09,az 09,az
2 3 4 09
J I
i z
j
09
h,
5 6
a
space 7 8 real
( int
14
other
* 10 * 11 )
13 9 12 Close
Quit
The Big Picture
First Prev Next Last Go Back Full Screen Close Quit
Syntax Analysis Home Page
X N is a nonterminal and
(N T ) is a string of terminals and nontermi-
Full Screen
nals
Close
a start symbol S N .
Quit
J I
S ab
Page 21 of 100
S aSb aabb
S aSb aaSbb aaabbb Go Back
ture of derivations.
Quit
S SS SSS SS . . . Close
1 JJ II
Derivation sequences
put an artificial order in which productions are fired. J I
Quit
Title Page
S
JJ II
S S
J I
S S Page 24 of 100
Go Back
a S b a S b
Full Screen
Derivation tree of
a S b
abaabb Close
Quit
Title Page
S JJ II
S S
J I
S S a S b Page 25 of 100
Go Back
a S b a S b
Full Screen
Another
Close
Derivation tree of
abaabb
Quit
Title Page
S
JJ II
S S
J I
S S a S b Page 26 of 100
a b
Go Back
a S b S
Full Screen
Yet another
Close
Derivation tree of
abaabb
Quit
Title Page
JJ II
J I
Page 27 of 100
Go Back
Full Screen
Close
Quit
E I | C | E+E | EE
I y | z Title Page
C 4
Consider the sentence y + 4 z. JJ II
J I
E E
Page 28 of 100
Go Back
Full Screen
Close
Quit
E I | C | E+E | EE
I y | z Title Page
C 4
Consider the sentence y + 4 z. JJ II
J I
E E
Page 29 of 100
E + E E * E
Go Back
Full Screen
Close
Quit
E I | C | E+E | EE
I y | z Title Page
C 4
Consider the sentence y + 4 z. JJ II
J I
E E
Page 30 of 100
E + E E * E
Go Back
* E E + E
I E I
Full Screen
Close
Quit
E I | C | E+E | EE
I y | z Title Page
C 4
Consider the sentence y + 4 z. JJ II
J I
E E
Page 31 of 100
E + E E * E
Go Back
* E E + E
I E I
Full Screen
I I C
y C z
Close
Quit
E I | C | E+E | EE
I y | z Title Page
C 4
Consider the sentence y + 4 z. JJ II
J I
E E
Page 32 of 100
E + E E * E
Go Back
* E E + E
I E I
Full Screen
I I C
y C z
Close
z y 4
Quit
4
Title Page
JJ II
J I
Page 33 of 100
Go Back
Full Screen
Close
Quit
r1. E E T
Title Page
r2 E T
r3 T T / D
JJ II
r4 T D
r5 D a | b | ( E )
J I
a a / b
Page 34 of 100
Go Back
Full Screen
Close
Quit
r1. E E T
Title Page
r2 E T
r3 T T / D
JJ II
r4 T D
r5 D a | b | ( E )
J I
a / b
Page 35 of 100
Principle: Go Back
Reduce
whenever possible.
Full Screen
Shift only when
reduce is
impossible Close
a
Shift Quit
r1. E E T
Title Page
r2 E T
r3 T T / D
JJ II
r4 T D
r5 D a | b | ( E )
J I
a / b
Page 36 of 100
Go Back
Full Screen
Close
D Reduce by r5 Quit
r1. E E T
Title Page
r2 E T
r3 T T / D
JJ II
r4 T D
r5 D a | b | ( E )
J I
a / b
Page 37 of 100
Go Back
Full Screen
Close
T Reduce by r4 Quit
r1. E E T
Title Page
r2 E T
r3 T T / D
JJ II
r4 T D
r5 D a | b | ( E )
J I
a / b
Page 38 of 100
Go Back
Full Screen
Close
E Reduce by r2 Quit
r1. E E T
Title Page
r2 E T
r3 T T / D
JJ II
r4 T D
r5 D a | b | ( E )
J I
a / b
Page 39 of 100
Go Back
Full Screen
Close
Shift
E
Quit
r1. E E T
Title Page
r2 E T
r3 T T / D
JJ II
r4 T D
r5 D a | b | ( E )
J I
/ b
Page 40 of 100
Go Back
Full Screen
a
Shift Close
E
Quit
r1. E E T
Title Page
r2 E T
r3 T T / D
JJ II
r4 T D
r5 D a | b | ( E )
J I
/ b
Page 41 of 100
Go Back
Full Screen
D Reduce by r5 Close
E
Quit
r1. E E T
Title Page
r2 E T
r3 T T / D
JJ II
r4 T D
r5 D a | b | ( E )
J I
/ b
Page 42 of 100
Go Back
Full Screen
T Reduce by r4 Close
E
Quit
r1. E E T
Title Page
r2 E T
r3 T T / D
JJ II
r4 T D
r5 D a | b | ( E )
J I
/ b
Page 43 of 100
Go Back
Full Screen
T Reduce by r4 Close
E
Quit
r1. E E T
Title Page
r2 E T
r3 T T / D
JJ II
r4 T D
r5 D a | b | ( E )
J I
/ b
Page 44 of 100
Go Back
Full Screen
Close
E Reduce by r1 Quit
r1. E E T
Title Page
r2 E T
r3 T T / D
JJ II
r4 T D
r5 D a | b | ( E )
J I
b
Page 45 of 100
Go Back
Full Screen
Close
/
Shift
E
Quit
r1. E E T
Title Page
r2 E T
r3 T T / D
JJ II
r4 T D
r5 D a | b | ( E )
J I
Page 46 of 100
Go Back
Full Screen
b Shift Close
/
E
Quit
r1. E E T
Title Page
r2 E T
r3 T T / D
JJ II
r4 T D
r5 D a | b | ( E )
J I
Page 47 of 100
Go Back
Full Screen
D Reduce by r5 Close
/
E
Quit
r1. E E T
Title Page
r2 E T
r3 T T / D
JJ II
r4 T D
r5 D a | b | ( E )
J I
Page 48 of 100
Go Back
Full Screen
T
Reduce by r4 Close
/
E
Quit
r1. E E T
Title Page
r2 E T
r3 T T / D
JJ II
r4 T D
r5 D a | b | ( E )
J I
Page 49 of 100
Go Back
k!
Full Screen
uc
St
E Reduce by r2 Close
/
Get back!
E
Quit
r1. E E T
Title Page
r2 E T
r3 T T / D
JJ II
r4 T D
r5 D a | b | ( E )
J I
Page 50 of 100
Go Back
Full Screen
E Reduce by r2 Close
/
Get back!
E
Quit
r1. E E T
Title Page
r2 E T
r3 T T / D
JJ II
r4 T D
r5 D a | b | ( E )
J I
Page 51 of 100
Go Back
Full Screen
T
Reduce by r4 Close
Get back! /
E
Quit
r1. E E T
Title Page
r2 E T
r3 T T / D
JJ II
r4 T D
r5 D a | b | ( E )
J I
Page 52 of 100
Go Back
Full Screen
D Reduce by r5 Close
Get back! /
E
Quit
r1. E E T
Title Page
r2 E T
r3 T T / D
JJ II
r4 T D
r5 D a | b | ( E )
J I
Page 53 of 100
Go Back
Full Screen
E
Quit
r1. E E T
Title Page
r2 E T
r3 T T / D
JJ II
r4 T D
r5 D a | b | ( E )
J I
b
Page 54 of 100
Go Back
Full Screen
Close
/
Get back! Shift
E
Quit
r1. E E T
Title Page
r2 E T
r3 T T / D
JJ II
r4 T D
r5 D a | b | ( E )
J I
/ b
Page 55 of 100
Go Back
Full Screen
Get back to
where you Close
once belonged!
E Reduce by r1 Quit
o d i
m Principle:
r1. E E T
Title Page
r2 E T Reduce whenever possible, but
r3 T T / D but depending upon
JJ II
r4 T D
lookahead
r5 D a | b | ( E )
J I
/ b
Page 56 of 100
Shift instead
of reduce here!
Go Back
ce
i f t redu
Sh ict Full Screen
confl
T Reduce by r4 Close
E
Quit
r1. E E T
Title Page
r2 E T
r3 T T / D
JJ II
r4 T D
r5 D a | b | ( E )
J I
/ b
Page 57 of 100
Go Back
Full Screen
T Reduce by r4 Close
E
Quit
r1. E E T
Title Page
r2 E T
r3 T T / D
JJ II
r4 T D
r5 D a | b | ( E )
J I
b
Page 58 of 100
Go Back
Full Screen
/ Shift
T Close
E
Quit
r1. E E T
Title Page
r2 E T
r3 T T / D
JJ II
r4 T D
r5 D a | b | ( E )
J I
Page 59 of 100
Go Back
b
Shift Full Screen
/
T Close
E
Quit
r1. E E T
Title Page
r2 E T
r3 T T / D
JJ II
r4 T D
r5 D a | b | ( E )
J I
Page 60 of 100
Go Back
D Reduce by r5
Full Screen
/
T
Close
E
Quit
r1. E E T
Title Page
r2 E T
r3 T T / D
JJ II
r4 T D
r5 D a | b | ( E )
J I
Page 61 of 100
Go Back
Full Screen
T Reduce by r3 Close
E
Quit
r1. E E T
Title Page
r2 E T
r3 T T / D
JJ II
r4 T D
r5 D a | b | ( E )
J I
Page 62 of 100
Go Back
Full Screen
Close
E Reduce by r1 Quit
Title Page
r1. E E T
r4 T D
r2 E T
r3 T T / D r5 D a | b | ( E )
JJ II
J I
Page 63 of 100
Go Back
Full Screen
Close
a a / b
Quit
Title Page
r1. E E T
r4 T D
r2 E T
r3 T T / D r5 D a | b | ( E )
JJ II
J I
Page 64 of 100
Go Back
Full Screen
Close
a a / b
Quit
Title Page
r1. E E T
r4 T D
r2 E T
r3 T T / D r5 D a | b | ( E )
JJ II
J I
Page 65 of 100
Go Back
Full Screen
Close
a a / b
Quit
Title Page
r1. E E T
r4 T D
r2 E T
r3 T T / D r5 D a | b | ( E )
JJ II
J I
Page 66 of 100
Go Back
Full Screen
Close
a a / b
Quit
Title Page
r1. E E T
r4 T D
r2 E T
r3 T T / D r5 D a | b | ( E )
JJ II
J I
Page 67 of 100
Go Back
Full Screen
Close
a a / b
Quit
Title Page
r1. E E T
r4 T D
r2 E T
r3 T T / D r5 D a | b | ( E )
JJ II
J I
Page 68 of 100
Go Back
Full Screen
Close
a a / b
Quit
Title Page
r1. E E T
r4 T D
r2 E T
r3 T T / D r5 D a | b | ( E )
JJ II
J I
Page 69 of 100
Go Back
Full Screen
D D
Close
a a / b
Quit
Title Page
r1. E E T
r4 T D
r2 E T
r3 T T / D r5 D a | b | ( E )
JJ II
J I
Page 70 of 100
Go Back
T T
Full Screen
D D
Close
a a / b
Quit
Title Page
r1. E E T
r4 T D
r2 E T
r3 T T / D r5 D a | b | ( E )
JJ II
J I
Page 71 of 100
Go Back
T T
Full Screen
D D
Close
a a / b
Quit
Title Page
r1. E E T
r4 T D
r2 E T
r3 T T / D r5 D a | b | ( E )
JJ II
J I
Page 72 of 100
Go Back
T T
Full Screen
D D
Close
a a / b
Quit
Title Page
r1. E E T
r4 T D
r2 E T
r3 T T / D r5 D a | b | ( E )
JJ II
J I
Page 73 of 100
Go Back
T T
Full Screen
D D D
Close
a a / b
Quit
Title Page
r1. E E T
r4 T D
r2 E T
r3 T T / D r5 D a | b | ( E )
JJ II
J I
Page 74 of 100
E
T
Go Back
T T
Full Screen
D D D
Close
a a / b
Quit
Title Page
r1. E E T
r4 T D
r2 E T
r3 T T / D r5 D a | b | ( E )
JJ II
J I
E
Page 75 of 100
E
T
Go Back
T T
Full Screen
D D D
Close
a a / b
Quit
Yacc.
Shift-reduce conflicts if any, are automatically detected Go Back
Quit
Quit
unbounded time
J I
The parser of a programming language provides the
framework within which the target code is to be gener-
ated. Page 78 of 100
Semantic Analysis: 2
Title Page
JJ II
eters
type consistency between declaration and use. Go Back
Close
Quit
Title Page
JJ II
J I
Page 80 of 100
Go Back
Full Screen
Close
Quit
Title Page
E T F E
JJ II
/ ( ) n
T
J I
T F
/
Page 81 of 100
n
F
Go Back
( )
E
E T Full Screen
T
F
Close
F
n
Quit
Title Page
E T F E
JJ II
/ ( ) n
T
J I
T F
/
Page 82 of 100
n
F
Go Back
( )
E
E T Full Screen
Synthesized Attributes
4 3 2 1
T
F
Close
F
n
Quit
4 n
Title Page
E T F E
JJ II
/ ( ) n
T
J I
T F
/
Page 83 of 100
n
F
Go Back
( )
E
E T Full Screen
Synthesized Attributes
4 3 2 1
T
F
Close
4 F
n
Quit
4 n
Title Page
E T F E
JJ II
/ ( ) n
T
J I
T F
/
Page 84 of 100
n
F
Go Back
( )
E
E T Full Screen
Synthesized Attributes
4 3 2 1
4 T
F
Close
4 F
n
Quit
4 n
Title Page
E T F E
JJ II
/ ( ) n
T
J I
T F
/
Page 85 of 100
n
F
Go Back
( )
E
4 E T Full Screen
Synthesized Attributes
4 3 2 1
4 T
F
Close
4 F
n
Quit
4 n
Title Page
E T F E
JJ II
/ ( ) n
T
J I
T F
/
Page 86 of 100
n
F
Go Back
( )
E
4 E T Full Screen
Synthesized Attributes
4 3 2 1
4 T
F
Close
4 F
n 1
Quit
4 n
Title Page
E T F E
JJ II
/ ( ) n
T
J I
T F
/
Page 87 of 100
n
F
Go Back
( )
E
4 E T Full Screen
Synthesized Attributes
4 3 2 1
4 T
F 1
Close
4 F
n 1
Quit
4 n
Title Page
E T F E
JJ II
/ ( ) n
T
J I
T F
/
Page 88 of 100
n
F
Go Back
( )
E
4 E T Full Screen
1
Synthesized Attributes
4 3 2 1
4 T
F 1
Close
4 F
n 1
Quit
4 n
Title Page
E T F E
JJ II
/ ( ) n
T
J I
T F
/
Page 89 of 100
n
F
Go Back
( )
3
E
4 E T Full Screen
1
Synthesized Attributes
4 3 2 1
4 T
F 1
Close
4 F
n 1
Quit
4 n
Title Page
E T F E
JJ II
/ ( ) n
T
J I
T F
/
Page 90 of 100
n
3
F
Go Back
( )
3
E
4 E T Full Screen
1
Synthesized Attributes
4 3 2 1
4 T
F 1
Close
4 F
n 1
Quit
4 n
Title Page
E T F E
JJ II
/ ( ) n
T
J I
T 3 F
/
Page 91 of 100
n
3
F
Go Back
( )
3
E
4 E T Full Screen
1
Synthesized Attributes
4 3 2 1
4 T
F 1
Close
4 F
n 1
Quit
4 n
Title Page
E T F E
JJ II
/ ( ) n
T
J I
T 3 F
/
Page 92 of 100
n 2
3
F
Go Back
( )
3
E
4 E T Full Screen
1
Synthesized Attributes
4 3 2 1
4 T
F 1
Close
4 F
n 1
Quit
4 n
Title Page
E T F E
JJ II
/ ( ) n
T
J I
T 3 F 2
/
Page 93 of 100
n 2
3
F
Go Back
( )
3
E
4 E T Full Screen
1
Synthesized Attributes
4 3 2 1
4 T
F 1
Close
4 F
n 1
Quit
4 n
Title Page
E T F E
JJ II
/ ( ) n
T 1
J I
T 3 F 2
/
Page 94 of 100
n 2
3
F
Go Back
( )
3
E
4 E T Full Screen
1
Synthesized Attributes
4 3 2 1
4 T
F 1
Close
4 F
n 1
Quit
4 n
Title Page
E T F E 1
JJ II
/ ( ) n
T 1
J I
T 3 F 2
/
Page 95 of 100
n 2
3
F
Go Back
( )
3
E
4 E T Full Screen
1
Synthesized Attributes
4 3 2 1
4 T
F 1
Close
4 F
n 1
Quit
4 n
Title Page
E 1
E0 E1T B E0.val := sub(E1.val, T.val)
JJ II
T 1
E T B E.val := T.val
T 3 F 2
/ J I
F
3
n 2
T0 T1/F B T0.val := div(T1.val, F.val)
Page 96 of 100
( )
3
E
4 E T 1
T F B T.val := F.val
Go Back
4 T
F 1
4 n
F n B F.val := n.val Close
Quit
D TL T int | float
L L,I | I I x | y | z Title Page
D
JJ II
T L
J I
I
,
int L Page 97 of 100
z
I
Go Back
L ,
y Full Screen
I
D L T I
Close
x y z int x
Quit
D TL T int | float
L L,I | I I x | y | z Title Page
D
JJ II
T L
J I
I
,
int int L Page 98 of 100
z
I
Go Back
L ,
y Full Screen
I
D L T I
Close
x y z int x
Quit
, int
D TL T int | float
L L,I | I I x | y | z Title Page
D
JJ II
int T L
J I
I
,
int int L Page 99 of 100
z
I
Go Back
L ,
y Full Screen
I
D L T I
Close
x y z int x
Quit
, int int
D TL T int | float
L L,I | I I x | y | z Title Page
D
JJ II
int T L int
J I
I
,
int int L Page 100 of 100
z
I
Go Back
L ,
y Full Screen
I
D L T I
Close
x y z int x
Quit
, int int
D TL T int | float
L L,I | I I x | y | z Title Page
D
JJ II
int T L int
J I
I int
,
int int L int Page 101 of 100
z
I
Go Back
L ,
y Full Screen
I
D L T I
Close
x y z int x
Quit
, int int
D
Title Page
int T L int
JJ II
I int
,
int int L int
J I
z int
I int
L int , Page 102 of 100
y
Go Back
I
D L T I
Full Screen
x y z int x
Close
, int int
Quit
D TL T int | float
L L,I | I I x | y | z Title Page
D
JJ II
int T L int
J I
I int
,
int int L int Page 103 of 100
z int
I int
Go Back
L int ,
I int
D L T I
Close
x y z int x
Quit
, int int
D TL T int | float
L L,I | I I x | y | z Title Page
D
JJ II
int T L int
J I
I int
,
int int L int Page 104 of 100
z int
I int
Go Back
L int ,
I int
D L T I
Close
x y z int x int
Quit
, int int
D
D TL B L.in := T.type JJ II
int T L int
,
I int T int B T.type := int.int
int int L int J I
z int
L int ,
I int
T float B T.type := float.f loat
Page 105 of 100
y int
I int L0 L1,I B L1 := L0.in
Go Back
I id B id.type := I.in
Close
Quit
Title Page
JJ II
J I
Go Back
Full Screen
Close
Quit
E ET | T
T T /F | F Title Page
F n | (E)
Suppose we want to evaluate an expression (4 1)/2. JJ II
/
Go Back
2 Full Screen
Close
4 1
Quit
Title Page
JJ II
/
J I
2
Go Back
Full Screen
4 1
Close
Quit
Title Page
JJ II
/
J I
2
Go Back
Full Screen
4 1
Close
Quit
Title Page
JJ II
/
J I
3 2
Go Back
Full Screen
Close
Quit
Title Page
JJ II
/
J I
3 2
Go Back
Full Screen
Close
Quit
Title Page
1 JJ II
J I
Go Back
Full Screen
Close
But what we actually get during parsing is a tree that looks Quit
like . . .
First Prev Next Last Go Back Full Screen Close Quit
Abstract Syntax: 1
. . . THIS! E
Home Page
Title Page
T
T F JJ II
/
J I
n
F
/
Go Back
E T
n Full Screen
T
F
n n Close
F
n
Quit
Title Page
We use attribute grammar rules to construct the abstract
syntax tree (AST)!. JJ II
But in order to do that we first require two procedures for
tree construction.
J I
makeLeaf(literal) : Creates a node with label literal and re-
turns a pointer to it. Page 114 of 100
Quit
Title Page
T F B T.ptr := F.ptr
Go Back
Symbol Table:1
Title Page
JJ II
The store house of context-sensitive and run-time infor-
mation about every identifier in the source program.
J I
All accesses relating to an identifier require to first find
the attributes of the identifier from the symbol table Page 116 of 100
Close
Quit
scope/visibility information
Page 117 of 100
base address
addresses to location of auxiliary symbol tables (in case Go Back
of records, procedures, classes)
address of the location containing the string which ac- Full Screen
Quit
insertion
Page 118 of 100
search
deletions are purely logical (depending on scope Go Back
Quit
Semantic analysis:
Determination of types of identifiers from declara- Go Back
tions
type checking to ensure that operands are used in Full Screen
type-valid contexts.
Checking scope, visibility violations. Close
Quit
Title Page
Symbol Table:5 JJ II
IR generation: . Memory allocation and relativea address
calculation. J I
Close
Quit
memory size)
Full Screen
number of registers
memory size Close
word length
Quit
cations
no commitment to Representational Issues Go Back
4. To ensure type-safety
Full Screen
Next
First Prev Next Last Go Back Full Screen Close Quit
Home Page
Title Page
IR: Representation? JJ II
No commitment to word boundaries or byte boundaries
No commitment to representation of J I
Close
Quit
stoop? JJ II
so as to be interpreted easily,
Page 124 of 100
the interpreter is fairly small,
execution speeds are high, Go Back
Quit
rise? JJ II
typed variables,
temporary variables instead of registers. J I
array-indexing,
Page 125 of 100
random access to record fields,
parameter-passing, Go Back
Quit
JJ II
Three address code: A suite of instructions. Each instruc-
tion has at most 3 operands.
J I
an opcode representing an operation with at most 2
operands
Page 126 of 100
Quit
Title Page
A typical instruction JJ II
set: 2 J I
Assignments (LOAD-STORE)
Jumps (conditional and unconditional) Page 127 of 100
Close
Quit
set: 2 JJ II
Assignments (LOAD-STORE)
x := y bop z, where bop is a binary operation J I
Quit
set: 2 JJ II
Assignments (LOAD-STORE)
Jumps (conditional and unconditional) J I
Quit
set: 2 JJ II
Assignments (LOAD-STORE)
Jumps (conditional and unconditional) J I
Quit
Assignments (LOAD-STORE) JJ II
Assignments (LOAD-STORE)
JJ II
Jumps (conditional and unconditional)
Procedures and parameters J I
Picture
Quit
Title Page
x y x y
*x *y x := ^y @y *y
JJ II
x y x y
J I
*x @z *z @z
x := *y Page 133 of 100
*z *z
z z Go Back
y y
*y *y
Full Screen
x x
*x := y @z
@z z
z Close
*z *y
Quit
Quit
Quit
Title Page
E id B JJ II
J I
E.place := id.place;
E.code := emit()
Page 137 of 100
E0 E1 E2 B
Go Back
S id := E B Title Page
JJ II
S.code := E.code
|| emit(id.place:=E.place)
J I
S0 while E do S1 B
Page 138 of 100
S id := E B Title Page
JJ II
S.code := E.code
|| emit(id.place:=E.place)
J I
S0 while E do S1 B
Page 139 of 100
Quit
Main program
Title Page
Globals
Procedure P2
Locals of P2 JJ II
Procedure P21
Locals of P21 J I
Body of P21
Call P21
Page 141 of 100
Body of P2
Call P21
Go Back
Procedure P1
Locals of P1
Full Screen
Body of P1
Call P2
Close
Main body
Call P1
Quit
Main program
Title Page
Globals
Procedure P2 JJ II
Locals of P2
J I
Procedure P21
Locals of P21
Body of P21
Body of P2 Go Back
Procedure P1
Full Screen
Locals of P1
Body of P1
Close
Main body
Globals
Quit
Main program
Title Page
Globals
Procedure P2 JJ II
Locals of P2
J I
Procedure P21
Locals of P21
Body of P21
Body of P2 Go Back
Main program
Title Page
Globals
Procedure P2 JJ II
Locals of P2
Procedure P21 J I
Locals of P21
Main body
Globals
Quit
Main program
Title Page
Globals
Procedure P2 JJ II
Return address to last of P2
Locals of P2
Dynamic link to last P2
Locals of P21
Procedure P21 J I
Static link last P2
Locals of P21 Formal par P21
Main body
Globals
Quit
Title Page
JJ II
J I
Go Back
Full Screen
Close
Quit