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