comparison ppc/test/recrec.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 type r = record x: integer; q: record y, z: integer; end; end;
2
3 var m: r;
4
5 begin
6 m.x := 2; m.q.y := 3; m.q.z := 4;
7 print_num(m.x+m.q.y+m.q.z); newline()
8 end.
9
10 (*<<
11 9
12 >>*)
13
14 (*[[
15 MODULE Main 0 0
16 IMPORT Lib 0
17 ENDHDR
18
19 PROC MAIN 0 0 0
20 ! m.x := 2; m.q.y := 3; m.q.z := 4;
21 CONST 2
22 STGW _m
23 CONST 3
24 GLOBAL _m
25 STNW 4
26 CONST 4
27 GLOBAL _m
28 STNW 8
29 ! print_num(m.x+m.q.y+m.q.z); newline()
30 LDGW _m
31 GLOBAL _m
32 LDNW 4
33 PLUS
34 GLOBAL _m
35 LDNW 8
36 PLUS
37 CONST 0
38 GLOBAL lib.print_num
39 PCALL 1
40 CONST 0
41 GLOBAL lib.newline
42 PCALL 0
43 RETURN
44 END
45
46 GLOVAR _m 12
47 ! End
48 ]]*)