Start of Interpreter for program P9.tri at Sun Jun 03 15:10:04 2001

Program

# READ a
y:=((a*3)+(a*2))
WRITE y#

Parsing tree

root
READ
a
:=
y+
*
a3
*
a2
WRITE
y

Table of constants

c1=3c2=2

Table of identifiers

i1=ai2=y

Modified tree

root
READ
a
:=
y+
*
a3
*
a2
WRITE
y


Stackid a=0
interpreting the operator READ a
READ
a
:=
y+
*
a3
*
a2
WRITE
y
Input a=5

Stack

Stackid y=0

Stackid y=0id a=5

Stackid y=0id a=5const=3
interpreting the operator (a*3)
*
a3
*
a2

15 = 5 * 3

Stackid y=0tm=15

Stackid y=0tm=15id a=5

Stackid y=0tm=15id a=5const=2
interpreting the operator (a*2)
*
a2

10 = 5 * 2

Stackid y=0tm=15tm=10
interpreting the operator ((a*3)+(a*2))
+
*
a3
*
a2

25 = 15 + 10

Stackid y=0tm=25
interpreting the operator y:=((a*3)+(a*2))
:=
y+
*
a3
*
a2
WRITE
y

y:=25

Stack

Stackid y=25
interpreting the operator WRITE y
WRITE
y
Output y=25

Stack
program P9.tri is completed

THE VARIABLES:

a=5
y=25

Interpreter ended at Sun Jun 03 15:10:09 2001