Permalink
Browse files

Add an implementation of #6 in PIR

  • Loading branch information...
leto committed Dec 6, 2009
1 parent f3cc9a4 commit 879352dd5dc4b2359474496100b0d005838a84da
Showing with 27 additions and 0 deletions.
  1. +27 −0 parrot/006/01.pir
View
@@ -0,0 +1,27 @@
+# Copyright (C) 2009, Jonathan "Duke" Leto <jonathan@leto.net>
+
+.sub 'main'
+ .local int sum, squaresum
+ sum = 0
+ squaresum = 0
+ $I1 = 1
+ loop:
+ sum += $I1
+ $I2 = $I1 * $I1
+ squaresum += $I2
+ if $I1 >= 100 goto done
+ inc $I1
+ goto loop
+ done:
+ $I3 = sum * sum
+ $I4 = $I3 - squaresum
+ print $I4
+ print "\n"
+.end
+
+# Local Variables:
+# mode: pir
+# fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4 ft=pir:
+

0 comments on commit 879352d

Please sign in to comment.