Commits

Anonymous committed 438a57c

add ops test

Comments (0)

Files changed (4)

src/builtins/say.pir

     .return (c)
 .end
 .namespace []
+.sub 'fact'
+    .param int b
+    .local int c
+    c = fact b
+    .return (c)
+.end
+
+.sub 'square'
+    .param num b
+    .local num c
+    c = b*b
+    .return (c)
+.end
+.sub 'cube'
+    .param num b
+    .local num c
+    c = b*b
+    c = c*b
+    .return (c)
+.end
+.sub 'sqrt'
+    .param num b
+    .local num c
+    c = sqrt b
+    .return (c)
+.end
 .sub 'add'
     .param int a
     .param int b
     c = a+b
     .return (c)
 .end
-.namespace []
+.sub 'mul'
+    .param int a
+    .param int b
+    .local int c
+    c = a*b
+    .return (c)
+.end
+.sub 'rem'
+    .param int a
+    .param int b
+    .local int c
+    c = cmod a, b
+    .return (c)
+.end
+.sub 'div'
+    .param int a
+    .param int b
+    .local int c
+    c = div a, b
+    .return (c)
+.end
 .sub 'better'
     .param int a
     .param int b

src/gen_builtins.pir

     .return (c)
 .end
 .namespace []
+.sub 'fact'
+    .param int b
+    .local int c
+    c = fact b
+    .return (c)
+.end
+
+.sub 'square'
+    .param num b
+    .local num c
+    c = b*b
+    .return (c)
+.end
+.sub 'cube'
+    .param num b
+    .local num c
+    c = b*b
+    c = c*b
+    .return (c)
+.end
+.sub 'sqrt'
+    .param num b
+    .local num c
+    c = sqrt b
+    .return (c)
+.end
 .sub 'add'
     .param int a
     .param int b
     c = a+b
     .return (c)
 .end
-.namespace []
+.sub 'mul'
+    .param int a
+    .param int b
+    .local int c
+    c = a*b
+    .return (c)
+.end
+.sub 'rem'
+    .param int a
+    .param int b
+    .local int c
+    c = cmod a, b
+    .return (c)
+.end
+.sub 'div'
+    .param int a
+    .param int b
+    .local int c
+    c = div a, b
+    .return (c)
+.end
 .sub 'better'
     .param int a
     .param int b
+scene i: foo.
+
+[enter romeo and juliet]
+
+othello: plan the difference between 
+  a pretty pretty pretty pretty lord 
+  and 
+  the sum of a pretty pretty rose and a king.
+
+othello: proove the factorial of a king.
+othello: proove the square root of a pretty pretty king.
+othello: proove the sum of a pretty king and a rose.
+othello: proove the square of a pretty king.
+
+othello: proove the sum of twice a pretty king and a rose.
+othello: proove the factorial of the sum of a pretty king and a rose.
+othello: proove the difference between a pretty red pretty king and a rose.
+othello: proove the cube of a pretty king. 
+
+
+othello: proove the product of  the difference between a pretty pretty king and a rose and the difference between a pretty pretty king and a rose.
+othello: proove the sum of 
+  the remainder of the quotient between 
+    a rose and a pretty king
+  and
+    the square of the sum of a pretty king and a rose.
+
+othello: proove the sum of 
+  the quotient between 
+    a pretty king and a rose
+  and
+    the sum of a pretty pretty pretty king and a king.
+
+
+
+
+
+
+
Binary file modified.