home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.ee.pdx.edu
/
2014.02.ftp.ee.pdx.edu.tar
/
ftp.ee.pdx.edu
/
pub
/
users
/
Harry
/
compilers
/
p10
/
tst
/
readWrite.out.bak
< prev
next >
Wrap
Text File
|
2006-02-17
|
3KB
|
97 lines
PROGRAM IS
TYPE
A IS ARRAY OF integer;
R IS RECORD f1: integer; f2: real; f3: A; END;
VAR
i: integer := 0;
j: integer := i;
k: integer := i;
x: real := 0.0;
y: real := x;
z: real := x;
a: A := NIL;
r: R := NIL;
BEGIN
WRITE ("Test printing expressions...");
WRITE ((i + j), ((k * 43) + i), (((x - y) - z) - intToReal (i)));
WRITE ("Test reading complex L-values...");
READ (i, x, a[(i + j)], r.f1, r.f2, r.f3[(k * j)]);
END;
maxLexicalLevel = 0
===== String List Follows =====
str2: "Test reading complex L-values..."
str1: "Test printing expressions..."
===== Float List Follows =====
float1: 0.0
===== Intermediate Code Follows =====
! MAIN...
mainEntry
! VAR INITIALIZATION...
i := 0
! VAR INITIALIZATION...
j := i
! VAR INITIALIZATION...
k := i
! VAR INITIALIZATION...
x := 0.0
! VAR INITIALIZATION...
y := x
! VAR INITIALIZATION...
z := x
! VAR INITIALIZATION...
a := 0
! VAR INITIALIZATION...
r := 0
! WRITE STMT...
writeString str1
writeNewline
! WRITE STMT...
t1 := i + j (integer)
writeInt t1
t2 := k * 43 (integer)
t3 := t2 + i (integer)
writeInt t3
t4 := x - y (float)
t5 := t4 - z (float)
t6 := intToFloat (i)
t7 := t5 - t6 (float)
writeFloat t7
writeNewline
! WRITE STMT...
writeString str2
writeNewline
! READ STMT...
t8 := &i
readInt t8
t9 := &x
readFloat t9
if a = 0 then goto runtimeError2 (integer)
t10 := i + j (integer)
if t10 < 0 then goto runtimeError4 (integer)
t11 := *a
if t10 >= t11 then goto runtimeError4 (integer)
t11 := t10 * 4 (integer)
t11 := t11 + 4 (integer)
t11 := a + t11 (integer)
readInt t11
if r = 0 then goto runtimeError2 (integer)
readInt r
if r = 0 then goto runtimeError2 (integer)
t12 := r + 4 (integer)
readFloat t12
if r = 0 then goto runtimeError2 (integer)
t13 := r + 8 (integer)
t14 := *t13
if t14 = 0 then goto runtimeError2 (integer)
t15 := k * j (integer)
if t15 < 0 then goto runtimeError4 (integer)
t16 := *t14
if t15 >= t16 then goto runtimeError4 (integer)
t16 := t15 * 4 (integer)
t16 := t16 + 4 (integer)
t16 := t14 + t16 (integer)
readInt t16
! MAIN EXIT...
mainExit
=======================================