diff options
author | Camil Staps | 2016-04-27 10:37:13 +0200 |
---|---|---|
committer | Camil Staps | 2016-04-27 10:37:13 +0200 |
commit | 1af150e798c1580be42bc9e8f3880edbeb6fef29 (patch) | |
tree | 7f924f98de03ab054481f2050e5fd551a4dc9855 /Smurf.icl | |
parent | Initial commit (diff) |
Nicer cli
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 |