Created
April 25, 2012 15:38
-
-
Save Benabik/2490722 to your computer and use it in GitHub Desktop.
Dynamic Lexicals in PIR
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
.sub 'main' :main | |
.local pmc lex | |
.lex 'dynlex', lex | |
lex = new 'FixedStringArray', 2 | |
lex[0] = 'main' | |
'test'() | |
say lex | |
'test2'() | |
say lex | |
.end | |
.sub 'test' | |
$P0 = find_dynamic_lex 'dynlex' | |
$P0[1] = 'test' | |
.end | |
.sub 'test2' | |
$P0 = new 'FixedStringArray', 1 | |
$P0[0] = 'test2 rules' | |
store_dynamic_lex 'dynlex', $P0 | |
.end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment