Parrot Tutorial on Parrot Operations

there are a variety of operations you can perform. for instance, we can print out the contents of a register or a constant:

set i1, 10
print "the contents of register i1 is: "
print i1
print "\n"

the above instructions will result in the contents of register i1 is: 10

we can perform mathematical operations on registers:

# add the contents of i2 to the contents of i1
add i1, i1, i2

# multiply i2 by i4 and store in i3
mul i3, i2, i4

# increment i1 by one
inc i1

# decrement n3 by 1.5
dec n3, 1.5

we can even perform some simple string manipulation:

set s1, "fish"
set s2, "bone"
concat s1, s2       # s1 is now "fishbone"

set s3, "w"
substr s4, s1, 1, 7

concat s3, s4       # s3 is now "wishbone"
length i1, s3       # i1 is now 8