comparison ppc/test/baz.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 (* baz.p *)
2
3 var x: integer;
4
5 proc baz(u: integer): integer;
6 begin
7 x := u;
8 return x
9 end;
10
11 begin
12 print_num(baz(37)); newline();
13 print_num(x); newline()
14 end.
15
16 (*<<
17 37
18 37
19 >>*)
20
21 (*[[
22 MODULE Main 0 0
23 IMPORT Lib 0
24 ENDHDR
25
26 PROC _baz 0 0 0
27 ! x := u;
28 LDLW 16
29 STGW _x
30 ! return x
31 LDGW _x
32 RETURNW
33 END
34
35 PROC MAIN 0 0 0
36 ! print_num(baz(37)); newline();
37 CONST 37
38 CONST 0
39 GLOBAL _baz
40 PCALLW 1
41 CONST 0
42 GLOBAL lib.print_num
43 PCALL 1
44 CONST 0
45 GLOBAL lib.newline
46 PCALL 0
47 ! print_num(x); newline()
48 LDGW _x
49 CONST 0
50 GLOBAL lib.print_num
51 PCALL 1
52 CONST 0
53 GLOBAL lib.newline
54 PCALL 0
55 RETURN
56 END
57
58 GLOVAR _x 4
59 ! End
60 ]]*)