Ticket #2043: working_example.pir

File working_example.pir, 476 bytes (added by plobsing, 4 years ago)
Line 
1# Copyright (C) 2006-2009, Parrot Foundation.
2# $Id$
3
4.loadlib 'bit_ops'
5
6.sub 'main' :main
7    $S0 = <<'PIR'
8.sub "rot_sub"
9    .param int a
10    .param int b
11    $I0 = rot a, b, 16
12    .return ($I0)
13.end
14PIR
15    $P0 = compreg 'PIR'
16    $P0($S0)
17
18    .local int a, b
19    a = 0xDEADBEEF
20    b = 13
21    $I0 = rot a, b, 16
22    say $I0
23    $I0 = 'rot_sub'(a, b)
24    say $I0
25.end
26
27# Local Variables:
28#   mode: pir
29#   fill-column: 100
30# End:
31# vim: expandtab shiftwidth=4 ft=pir:
32