Start of TRIGOL Optimizing Compiler for a Program P14.tri at Wed Oct 01 19:11:08 2003


Program

# IF (((1*2)*3)=(2*3)) THEN F:=(7*(3+(2*5)))
F:=100#

Parsing tree

root
IF
=
*
*
12
3
*
23
:=
F*
7+
3*
25
:=
F100

Table of constants
c1=1c2=2c3=3c4=7c5=5c6=100

Table of identifiers
i1=F

Modified tree:

root
IF
=
*
*
12
3
*
23
:=
F*
7+
3*
25
:=
F100


Compiler to Assembler started

; gen_header: source text
; # IF (1*2*3)=(2*3) THEN F:=7*(3+(2*5)); F:=100 #
;
; Program P14.asm
	.MODEL	small
	.STACK	100h
; gen_header: Rd=0 Wr=0
; gen_header: # of identifiers=1
.DATA F DW 0 dTv0 DW 0 dTv1 DW 0 ; gen_header: code segment'll start
.CODE ProgramStart: mov ax,@data mov ds,ax
Stack1

Stack12
; compiling the operator (1*2)
*
12
3
constant expression, I'll optimize..
2 = 1 * 2

Stack3
; compiling the operator ((1*2)*3)
*
*
12
3
*
23
constant expression, I'll optimize..
6 = 2 * 3

Stack2

Stack23
; compiling the operator (2*3)
*
23
constant expression, I'll optimize..
6 = 2 * 3
; compiling the operator (((1*2)*3)=(2*3))
=
*
*
12
3
*
23
constant expression, I'll optimize..
6 = 6 ?
; compiling the operator IF (((1*2)*3)=(2*3)) THEN
IF
=
*
*
12
3
*
23
:=
F*
7+
3*
25
:=
F100

Stack

StackF

StackF7

StackF73

StackF732

StackF7325
; compiling the operator (2*5)
*
25
constant expression, I'll optimize..
10 = 2 * 5
; compiling the operator (3+(2*5))
+
3*
25
constant expression, I'll optimize..
13 = 3 + 10
; compiling the operator (7*(3+(2*5)))
*
7+
3*
25
constant expression, I'll optimize..
91 = 7 * 13
; compiling the operator F:=(7*(3+(2*5)))
:=
F*
7+
3*
25
:=
F100
mov ax,91 mov F,ax
Stack

StackF

StackF100
; compiling the operator F:=100
:=
F100
mov ax,100 mov F,ax
Stack
mov ah,4ch int 21h END ProgramStart programm P14.asm is compiled

I'll start compiler from assembler, and linker

tasm P14 >>P14oc.htm
Turbo Assembler Version 3.1 Copyright (c) 1988, 1992 Borland International Assembling file: P14.ASM Error messages: None Warning messages: None Passes: 1 Remaining memory: 458k
tlink P14+teek >>P14oc.htm
Turbo Link Version 2.0 Copyright (c) 1987, 1988 Borland International

Compiler ended at Wed Oct 01 19:11:09 2003