comparison ppc/test/nest.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(x: integer): integer; begin return 2*x end;
2 begin print_num(f(f(3))); newline() end.
3
4 (*<<
5 12
6 >>*)
7
8 (*[[
9 MODULE Main 0 0
10 IMPORT Lib 0
11 ENDHDR
12
13 PROC _f 0 0 0
14 ! proc f(x: integer): integer; begin return 2*x end;
15 CONST 2
16 LDLW 16
17 TIMES
18 RETURNW
19 END
20
21 PROC MAIN 0 0 0
22 ! begin print_num(f(f(3))); newline() end.
23 CONST 3
24 CONST 0
25 GLOBAL _f
26 PCALLW 1
27 CONST 0
28 GLOBAL _f
29 PCALLW 1
30 CONST 0
31 GLOBAL lib.print_num
32 PCALL 1
33 CONST 0
34 GLOBAL lib.newline
35 PCALL 0
36 RETURN
37 END
38
39 ! End
40 ]]*)