Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Branch: nqp_pct
Fetching contributors…

Cannot retrieve contributors at this time

51 lines (32 sloc) 0.903 kB
# Copyright (C) 2001-2005, Parrot Foundation.
=head1 NAME
examples/subs/pasm_sub1.pasm - Parrot calling conventions
=head1 SYNOPSIS
% ./parrot examples/subs/pasm_sub1.pasm
=head1 DESCRIPTION
Sample subroutines in Parrot assembler.
Shows you how to create a C<.Sub> and C<invokecc> it.
= TODO
Examples for parameter passing.
=head1 SEE ALSO
F<docs/ops/core.pod>
F<docs/pdds/pdd03_calling_conventions.pod>
=cut
.pcc_sub :main main:
# Fetch a subroutine object
.const 'Sub' P0 = "_sub"
# Call the sub in argument, create return continuation
invokecc P0
# got here, because the sub invoked the return continuation
print "Hello from main\n"
end
# A subroutine
.pcc_sub _sub:
print "Hello from subroutine\n"
# Call the return continuation
returncc
# Local Variables:
# mode: pir
# fill-column: 100
# End:
# vim: expandtab shiftwidth=4 ft=pir:
Jump to Line
Something went wrong with that request. Please try again.