aboutsummaryrefslogtreecommitdiff
path: root/Smurf.icl
diff options
context:
space:
mode:
Diffstat (limited to 'Smurf.icl')
-rw-r--r--Smurf.icl21
1 files changed, 21 insertions, 0 deletions
diff --git a/Smurf.icl b/Smurf.icl
index f00ef65..00da0aa 100644
--- a/Smurf.icl
+++ b/Smurf.icl
@@ -12,8 +12,14 @@ import Control.Applicative
import Control.Monad
import Data.Maybe
+import GenEq
+
import SmurfParse
+derive gEq Stm
+
+instance == Stm where == a b = a === b
+
instance zero [a] where zero = []
instance toString Stm
@@ -29,6 +35,21 @@ where
toString Get = "g"
toString Exec = "x"
+instance toChar Stm where toChar stm = (toString stm).[0]
+
+instance fromChar Stm
+where
+ fromChar '"' = Push ""
+ fromChar 'i' = Input
+ fromChar 'o' = Output
+ fromChar '+' = Cat
+ fromChar 'h' = Head
+ fromChar 't' = Tail
+ fromChar 'q' = Quotify
+ fromChar 'p' = Put
+ fromChar 'g' = Get
+ fromChar 'x' = Exec
+
instance zero State where zero = { stack = zero, store = zero }
instance toString State