Created
August 18, 2011 08:15
-
-
Save anonymous/1153639 to your computer and use it in GitHub Desktop.
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@kiwi:~/nom/parrot$ cat a.pir | |
.sub 'main' :main | |
.lex '$a', $P99 | |
$P99 = box 1 | |
.local pmc lexpad, lexiter | |
$P0 = getinterp | |
lexpad = $P0['lexpad'] | |
lexiter = iter lexpad | |
loop: | |
unless lexiter goto done | |
.local pmc item, key, value | |
item = shift lexiter | |
key = item.'key'() | |
value = item.'value'() | |
print "item.key = " | |
say key | |
print "item.value = " | |
say value | |
print "lexpad[item.key]= " | |
$P0 = lexpad[key] | |
say $P0 | |
goto loop | |
done: | |
.end | |
pmichaud@kiwi:~/nom/parrot$ ./parrot a.pir | |
item.key = $a | |
item.value = 23 | |
lexpad[item.key]= 1 | |
pmichaud@kiwi:~/nom/parrot$ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment