This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ cat z | |
grammar ABC { | |
token TOP { abc | <oops: "Failed to find abc!"> } | |
method oops($msg) { die $msg; } | |
} | |
ABC.parse('xyz'); | |
$ ./perl6 z | |
Failed to find abc! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pmichaud@plum:~/rakudo$ ./perl6 | |
> my $b = 5; sub foo($a) { $b++; $a++; say $a; }; foo($b) | |
Cannot assign to readonly variable. | |
in sub foo (<unknown>:1) | |
called from Main (<unknown>:1) | |
> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ cat x.pir | |
.sub 'main' | |
$S0 = "140" | |
$N0 = $S0 | |
say $N0 | |
$I0 = find_encoding 'ucs2' | |
$S0 = trans_encoding $S0, $I0 | |
$N0 = $S0 | |
say $N0 | |
.end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pmichaud@orange:~/rakudo$ cat k-nucleotide.p6.pl | |
# The Computer Language Benchmarks Game | |
# | |
# Based on the submission for Perl 5. | |
# contributed by Daniel carrera | |
# | |
# USAGE: perl6 k-nucleotide.p6.pl < k-nucleotide.input | |
# Read FASTA file from stdin and extract DNA sequence THREE. | |
my $sequence = ''; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ cat x1.pir | |
.HLL 'foo' | |
.sub 'main' | |
.local pmc obj | |
$P0 = newclass 'P6object' | |
$P1 = subclass $P0, 'Object' | |
$P2 = subclass $P1, 'Any' | |
$P3 = subclass $P2, 'Range' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ cat x2.pir | |
.HLL 'foo' | |
.sub 'main' | |
.local pmc obj | |
$P0 = newclass 'P6object' | |
$P1 = subclass $P0, 'Object' | |
$P2 = subclass $P1, 'Any' | |
$P3 = subclass $P2, 'Range' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ cat m1.pir | |
.HLL 'foo' | |
.sub 'main' | |
$P0 = get_root_namespace ['parrot';'Integer'] | |
$P0 = get_class $P0 | |
$P1 = subclass $P0, 'MyInt' | |
$P2 = getinterp | |
$P2.'hll_map'($P0, $P1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.HLL 'foo' | |
.sub 'main' | |
$P0 = get_root_namespace ['parrot';'Integer'] | |
$P0 = get_class $P0 | |
$P1 = subclass $P0, 'MyInt' | |
$P2 = getinterp | |
# $P2.'hll_map'($P0, $P1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pmichaud@orange:~/rakudo$ cat y | |
my $r = 1..5; | |
Q:PIR { | |
$P0 = find_lex '$r' | |
$S0 = $P0.'Str'() | |
say $S0 | |
$S0 = $P0 | |
say $S0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pmichaud@orange:~/rakudo$ cat z | |
my $a = "你好"; | |
Q:PIR { | |
$P0 = find_lex '$a' | |
$S0 = $P0 | |
$I0 = bytelength $S0 | |
say $I0 | |
}; |
OlderNewer