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