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