aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortomsmeding <hallo@tomsmeding.nl>2015-09-15 23:06:28 +0200
committertomsmeding <hallo@tomsmeding.nl>2015-09-15 23:06:28 +0200
commit09c405ae45cf44758be1af641462044c5ae5c7ae (patch)
tree171ccd795a9575efba20422d7e34733b56fcbf12
parentd83f843f7d4610f393014a1e6ff1cee38e1ead9a (diff)
New spec propagate
-rw-r--r--fibo.rip2
-rw-r--r--rip.hs20
-rw-r--r--testif.rip8
3 files changed, 16 insertions, 14 deletions
diff --git a/fibo.rip b/fibo.rip
index 0033d14..af9ff54 100644
--- a/fibo.rip
+++ b/fibo.rip
@@ -2,5 +2,5 @@
1W[
DO
9io
- D3r+
+ D3ra
1]
diff --git a/rip.hs b/rip.hs
index 25ff98f..3c2ab2b 100644
--- a/rip.hs
+++ b/rip.hs
@@ -45,10 +45,10 @@ rip' (x:xs) st = case x of
n | '0' <= n && n <= '9' ->
rip' xs (fromIntegral (ord n - ord '0') : st)
- 'p' ->
+ 'P' ->
rip' xs (tail st)
- 's' ->
+ 'S' ->
rip' xs (b:a:cs)
where (a:b:cs) = st
@@ -77,31 +77,31 @@ rip' (x:xs) st = case x of
(begin, rest) = (take (fromIntegral n) newst, drop (fromIntegral n) newst)
res = last begin : init begin ++ rest --SLOW!
- '+' ->
+ 'a' ->
rip' xs (a + b : cs)
where (b:a:cs) = st
- '-' ->
+ 's' ->
rip' xs (a - b : cs)
where (b:a:cs) = st
- '*' ->
+ 'm' ->
rip' xs (a * b : cs)
where (b:a:cs) = st
- '/' ->
+ 'q' ->
rip' xs (a `div` b : cs)
where (b:a:cs) = st
- '>' ->
+ 'G' ->
rip' xs (booltoint (a > b) : cs)
where (b:a:cs) = st
- '<' ->
+ 'L' ->
rip' xs (booltoint (a < b) : cs)
where (b:a:cs) = st
- '=' ->
+ 'E' ->
rip' xs (booltoint (a == b) : cs)
where (b:a:cs) = st
@@ -144,7 +144,7 @@ rip' (x:xs) st = case x of
c <- getChar
rip' xs (fromIntegral (ord c) : st)
- 'S' -> do
+ '$' -> do
print st
rip' xs st
diff --git a/testif.rip b/testif.rip
index b11c6b1..f4ebcee 100644
--- a/testif.rip
+++ b/testif.rip
@@ -1,4 +1,6 @@
-2 1 >
-I [1 O]
-2 1 <
+49im2aO 9io
+2 1 G
+D I [1 O]
+1 S s
I [0 O]
+9io