Skip to content

Instantly share code, notes, and snippets.

Created August 18, 2011 08:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/1153639 to your computer and use it in GitHub Desktop.
Save anonymous/1153639 to your computer and use it in GitHub Desktop.
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