diff options
Diffstat (limited to 'rip.hs')
-rw-r--r-- | rip.hs | 20 |
1 files changed, 10 insertions, 10 deletions
@@ -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 |