From 09c405ae45cf44758be1af641462044c5ae5c7ae Mon Sep 17 00:00:00 2001 From: tomsmeding Date: Tue, 15 Sep 2015 23:06:28 +0200 Subject: New spec propagate --- fibo.rip | 2 +- rip.hs | 20 ++++++++++---------- testif.rip | 8 +++++--- 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 -- cgit v1.2.3-70-g09d2