Start of Interpreter for program P6.tri at Sat Apr 03 16:11:24 2004

Program

# READ n
F:=1
I:=0
M1: I:=(I+1)
IF (I>n) THEN GOTO M2
F:=(F*I)
GOTO M1
M2: WRITE F#

Parsing tree

root
READ
n
:=
F1
:=
I0
label
M1
:=
I+
I1
IF
>
In
GOTO
label
M2
:=
F*
FI
GOTO
label
M1
label
M2
WRITE
F

Table of constants

c1=1c2=0

Table of identifiers

i1=ni2=Fi3=Ii4=M1i5=M2

label 'M1' is address of the operator {omistamine} (00481A20)
label 'M2' is address of the operator {kirjutamine} (00481840)

Modified tree

root
READ
n
:=
F1
:=
I0
:=
I+
I1
IF
>
In
GOTO
label
M2
:=
F*
FI
GOTO
label
M1
WRITE
F


Stackid n=0
interpreting the operator READ n
READ
n
:=
F1
:=
I0
:=
I+
I1
IF
>
In
GOTO
label
M2
:=
F*
FI
GOTO
label
M1
WRITE
F
Input n=3

Stack

Stackid F=0

Stackid F=0const=1
interpreting the operator F:=1
:=
F1
:=
I0
:=
I+
I1
IF
>
In
GOTO
label
M2
:=
F*
FI
GOTO
label
M1
WRITE
F

F:=1

Stack

Stackid I=0

Stackid I=0const=0
interpreting the operator I:=0
:=
I0
:=
I+
I1
IF
>
In
GOTO
label
M2
:=
F*
FI
GOTO
label
M1
WRITE
F

I:=0

Stack
M1:
Stackid I=0

Stackid I=0id I=0

Stackid I=0id I=0const=1
interpreting the operator (I+1)
+
I1

1 = 0 + 1

Stackid I=0tm=1
interpreting the operator I:=(I+1)
:=
I+
I1
IF
>
In
GOTO
label
M2
:=
F*
FI
GOTO
label
M1
WRITE
F

I:=1

Stack

Stackid I=1

Stackid I=1id n=3
interpreting the operator (I>n)
>
In

1 > 3 ?

Stacktm=0
interpreting the operator IF (I>n) THEN
IF
>
In
GOTO
label
M2
:=
F*
FI
GOTO
label
M1
WRITE
F

Stackid F=1

Stackid F=1id F=1

Stackid F=1id F=1id I=1
interpreting the operator (F*I)
*
FI

1 = 1 * 1

Stackid F=1tm=1
interpreting the operator F:=(F*I)
:=
F*
FI
GOTO
label
M1
WRITE
F

F:=1

Stack

StackM1:
interpreting the operator M1:
label
M1

StackM1:
interpreting the operator GOTO M1
GOTO
label
M1
WRITE
F
goto M1
M1:
Stackid I=1

Stackid I=1id I=1

Stackid I=1id I=1const=1
interpreting the operator (I+1)
+
I1

2 = 1 + 1

Stackid I=1tm=2
interpreting the operator I:=(I+1)
:=
I+
I1
IF
>
In
GOTO
label
M2
:=
F*
FI
GOTO
label
M1
WRITE
F

I:=2

Stack

Stackid I=2

Stackid I=2id n=3
interpreting the operator (I>n)
>
In

2 > 3 ?

Stacktm=0
interpreting the operator IF (I>n) THEN
IF
>
In
GOTO
label
M2
:=
F*
FI
GOTO
label
M1
WRITE
F

Stackid F=1

Stackid F=1id F=1

Stackid F=1id F=1id I=2
interpreting the operator (F*I)
*
FI

2 = 1 * 2

Stackid F=1tm=2
interpreting the operator F:=(F*I)
:=
F*
FI
GOTO
label
M1
WRITE
F

F:=2

Stack

StackM1:
interpreting the operator M1:
label
M1

StackM1:
interpreting the operator GOTO M1
GOTO
label
M1
WRITE
F
goto M1
M1:
Stackid I=2

Stackid I=2id I=2

Stackid I=2id I=2const=1
interpreting the operator (I+1)
+
I1

3 = 2 + 1

Stackid I=2tm=3
interpreting the operator I:=(I+1)
:=
I+
I1
IF
>
In
GOTO
label
M2
:=
F*
FI
GOTO
label
M1
WRITE
F

I:=3

Stack

Stackid I=3

Stackid I=3id n=3
interpreting the operator (I>n)
>
In

3 > 3 ?

Stacktm=0
interpreting the operator IF (I>n) THEN
IF
>
In
GOTO
label
M2
:=
F*
FI
GOTO
label
M1
WRITE
F

Stackid F=2

Stackid F=2id F=2

Stackid F=2id F=2id I=3
interpreting the operator (F*I)
*
FI

6 = 2 * 3

Stackid F=2tm=6
interpreting the operator F:=(F*I)
:=
F*
FI
GOTO
label
M1
WRITE
F

F:=6

Stack

StackM1:
interpreting the operator M1:
label
M1

StackM1:
interpreting the operator GOTO M1
GOTO
label
M1
WRITE
F
goto M1
M1:
Stackid I=3

Stackid I=3id I=3

Stackid I=3id I=3const=1
interpreting the operator (I+1)
+
I1

4 = 3 + 1

Stackid I=3tm=4
interpreting the operator I:=(I+1)
:=
I+
I1
IF
>
In
GOTO
label
M2
:=
F*
FI
GOTO
label
M1
WRITE
F

I:=4

Stack

Stackid I=4

Stackid I=4id n=3
interpreting the operator (I>n)
>
In

4 > 3 ?

Stacktm=1
interpreting the operator IF (I>n) THEN
IF
>
In
GOTO
label
M2
:=
F*
FI
GOTO
label
M1
WRITE
F

Stack

StackM2:
interpreting the operator M2:
label
M2

StackM2:
interpreting the operator GOTO M2
GOTO
label
M2
:=
F*
FI
GOTO
label
M1
WRITE
F
goto M2
M2:
Stackid F=6
interpreting the operator WRITE F
WRITE
F
Output F=6

Stack
program P6.tri is completed

THE VARIABLES:

n=3
F=6
I=4

Interpreter ended at Sat Apr 03 16:11:29 2004