Start of Interpreter for program P7.tri at Wed Apr 23 12:39:36 2003

Program

# READ a
READ b
READ c
F:=((a*(b+(2*c)))/2)
WRITE F#

Parsing tree

root
READ
a
READ
b
READ
c
:=
F/
*
a+
b*
2c
2
WRITE
F

Table of constants

c1=2

Table of identifiers

i1=ai2=bi3=ci4=F

Modified tree

root
READ
a
READ
b
READ
c
:=
F/
*
a+
b*
2c
2
WRITE
F


Stackid a=0
interpreting the operator READ a
READ
a
READ
b
READ
c
:=
F/
*
a+
b*
2c
2
WRITE
F
Input a=5

Stack

Stackid b=0
interpreting the operator READ b
READ
b
READ
c
:=
F/
*
a+
b*
2c
2
WRITE
F
Input b=3

Stack

Stackid c=0
interpreting the operator READ c
READ
c
:=
F/
*
a+
b*
2c
2
WRITE
F
Input c=2

Stack

Stackid F=0

Stackid F=0id a=5

Stackid F=0id a=5id b=3

Stackid F=0id a=5id b=3const=2

Stackid F=0id a=5id b=3const=2id c=2
interpreting the operator (2*c)
*
2c

4 = 2 * 2

Stackid F=0id a=5id b=3tm=4
interpreting the operator (b+(2*c))
+
b*
2c

7 = 3 + 4

Stackid F=0id a=5tm=7
interpreting the operator (a*(b+(2*c)))
*
a+
b*
2c
2

35 = 5 * 7

Stackid F=0tm=35

Stackid F=0tm=35const=2
interpreting the operator ((a*(b+(2*c)))/2)
/
*
a+
b*
2c
2

17 = 35 / 2

Stackid F=0tm=17
interpreting the operator F:=((a*(b+(2*c)))/2)
:=
F/
*
a+
b*
2c
2
WRITE
F

F:=17

Stack

Stackid F=17
interpreting the operator WRITE F
WRITE
F
Output F=17

Stack
program P7.tri is completed

THE VARIABLES:

a=5
b=3
c=2
F=17

Interpreter ended at Wed Apr 23 12:39:46 2003