diff options
Diffstat (limited to 'Smurf.icl')
-rw-r--r-- | Smurf.icl | 21 |
1 files changed, 21 insertions, 0 deletions
@@ -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 |