comparison ppc/test/memkill.p @ 0:bfdcc3820b32

Basis
author Mike Spivey <mike@cs.ox.ac.uk>
date Thu, 05 Oct 2017 08:04:15 +0100
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:bfdcc3820b32
1 proc f(): integer;
2 var x, y: integer;
3 begin
4 x := 3;
5 y := x + 1;
6 g();
7 return x + 1
8 end;
9
10 proc g(); begin end;
11
12 begin
13 print_num(f()); newline()
14 end.
15
16 (*<<
17 4
18 >>*)
19
20 (*[[
21 MODULE Main 0 0
22 IMPORT Lib 0
23 ENDHDR
24
25 PROC _f 8 0 0
26 ! x := 3;
27 CONST 3
28 STLW -4
29 ! y := x + 1;
30 LDLW -4
31 CONST 1
32 PLUS
33 STLW -8
34 ! g();
35 CONST 0
36 GLOBAL _g
37 PCALL 0
38 ! return x + 1
39 LDLW -4
40 CONST 1
41 PLUS
42 RETURNW
43 END
44
45 PROC _g 0 0 0
46 ! proc g(); begin end;
47 RETURN
48 END
49
50 PROC MAIN 0 0 0
51 ! print_num(f()); newline()
52 CONST 0
53 GLOBAL _f
54 PCALLW 0
55 CONST 0
56 GLOBAL lib.print_num
57 PCALL 1
58 CONST 0
59 GLOBAL lib.newline
60 PCALL 0
61 RETURN
62 END
63
64 ! End
65 ]]*)