This file contains hidden or 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 | |
| grammar ABC { | |
| token TOP { $<num>=[\d+] <?{ +$<num> <= 255 }> } | |
| } | |
| for 1, 1000, 255, 256, 17 { | |
| print($_); | |
| say( ABC.parse($_) ?? ' matches' !! " doesn't match" ); |
This file contains hidden or 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:~/ng$ ./perl6 --target=pir | |
| > my $a = 3; $a += 3; $a /= 2; | |
| .HLL "perl6" | |
| .namespace [] | |
| .sub "_block11" :anon :subid("10_1257087074.8071") | |
| .annotate "line", 1 | |
| new $P13, "ObjectRef" | |
| get_hll_global $P14, ["Bool"], "True" |
This file contains hidden or 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
| PAST::Op.new( | |
| :name('say'), | |
| PAST::OP.new( | |
| :name('&infix:<+>'), | |
| PAST::Var.new( :name('$a'), :scope('lexical')), | |
| PAST::Val.new( :value(1), :returns('Int') ) | |
| ) | |
| ); |
This file contains hidden or 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
| NQP: | |
| PAST::Op.new( | |
| :name('say'), | |
| :pasttype('call'), | |
| PAST::OP.new( | |
| :name('&infix:<+>'), | |
| :pasttype('call'), | |
| PAST::Var.new( :name('$a'), :scope('lexical')), | |
| PAST::Val.new( :value(1), :returns('Int') ) |
This file contains hidden or 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 | |
| END { say('world'); } | |
| say('hello'); | |
| $ ./perl6 x | |
| hello | |
| world | |
| $ ./perl6 t/01-sanity/09-end-blocks.t | |
| 1..2 |
This file contains hidden or 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
| orange:~/parrot/trunk$ cat cs.patch | |
| Index: src/pmc/codestring.pmc | |
| =================================================================== | |
| --- src/pmc/codestring.pmc (revision 42340) | |
| +++ src/pmc/codestring.pmc (working copy) | |
| @@ -35,11 +35,43 @@ | |
| #endif | |
| pmclass CodeString extends String provides string auto_attrs { | |
| - ATTR INTVAL last_line_number; /* most recent line number seen */ |
This file contains hidden or 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 | |
| END { say 'end 1'; } | |
| INIT { say 'init 1'; } | |
| CHECK { say 'check 1'; } | |
| CHECK { say 'check 2'; } | |
| INIT { say 'init 2'; } | |
| END { say 'end 2'; } |
This file contains hidden or 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
| /usr/bin/perl build/gen_builtins_pir.pl src/glue/phasers.pir src/glue/role.pir src/glue/run.pir src/glue/types.pir src/builtins/Object.pir src/builtins/ClassHOW.pir src/builtins/RoleHOW.pir src/builtins/GrammarHOW.pir src/builtins/Any.pir src/builtins/Role.pir src/builtins/Abstraction.pir src/builtins/Grammar.pir src/builtins/Bool.pir src/builtins/Int.pir src/builtins/Num.pir src/builtins/Str.pir src/builtins/Pair.pir src/builtins/Callable.pir src/builtins/Positional.pir src/builtins/Parcel.pir src/builtins/List.pir src/builtins/ListIterator.pir src/builtins/Array.pir src/builtins/Proxy.pir src/builtins/Code.pir src/builtins/Block.pir src/builtins/Routine.pir src/builtins/Sub.pir src/builtins/Method.pir src/builtins/ContainerDeclarand.pir src/builtins/Exception.pir src/builtins/assign.pir src/builtins/control.pir > src/gen/builtins.pir | |
| /usr/bin/perl build/gen_cheats_pir.pl src/cheats/autoincrement.pir src/cheats/fail.pir src/cheats/object.pir src/cheats/postcircumfix-array.pir src/cheats/print-say.pir src/ch |
This file contains hidden or 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
| our method push(*@values) is export { | |
| my @a = @values; | |
| Q:PIR { | |
| $P0 = find_lex '@a' | |
| $P0 = getattribute $P0, '$!values' | |
| $P1 = find_lex 'self' | |
| $P1 = getattribute $P1, '$!values' | |
| $I0 = elements $P1 | |
| splice $P1, $P0, $I0, 0 | |
| } |
This file contains hidden or 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
| "List": | |
| ($a, @b, 1..1000, $c).map( { ... } ); | |
| We need the lazy interpolating characteristics of list | |
| context, but we don't want to be preserving every value | |
| (e.g., the 1..1000) that is processed. Also, the elements | |
| that are processed by .map are the original containers. | |
| A "List" (but not the Parcel that produced it) is mutable | |
| because we consume the values as we iterate over the list. |