aboutsummaryrefslogtreecommitdiff
path: root/run.icl
diff options
context:
space:
mode:
Diffstat (limited to 'run.icl')
-rw-r--r--run.icl15
1 files changed, 10 insertions, 5 deletions
diff --git a/run.icl b/run.icl
index 64ef079..385d987 100644
--- a/run.icl
+++ b/run.icl
@@ -17,6 +17,11 @@ import SmurfParse
derive gEq SmurfOpt
instance == SmurfOpt where == a b = a === b
+instance <<< Expr
+where
+ (<<<) f (Lit s) = f <<< s
+ // TODO Rest unimplemented for now
+
Start :: *World -> *World
Start w
// Options
@@ -25,7 +30,7 @@ Start w
| errs <> [] = error errs w
# breakstms
= if (isMember BreakAll opts)
- [Push "", Input, Output, Cat, Head, Tail, Quotify, Put, Get, Exec]
+ [Push (Lit ""), Input, Output, Cat, Head, Tail, Quotify, Put, Get, Exec]
[fromChar c \\ (Break c) <- opts]
# inputs = [f \\ (IFile f) <- opts]
| length inputs <> 1 = error ["Exactly one input file required"] w
@@ -61,18 +66,18 @@ where
where
isBrk :: Program -> Bool
isBrk [] = False
- isBrk [(Push _):_] = isMember (Push "") brk
+ isBrk [(Push _):_] = isMember (Push (Lit "")) brk
isBrk [stm:_] = isMember stm brk
iofunc :: *IO *File
iofunc = IO read show
where
- read :: *File -> *(String, *File)
+ read :: *File -> *(Expr, *File)
read f
# (s, f) = freadline f
- = (s % (0, size s - 2), f)
+ = (Lit (s % (0, size s - 2)), f)
- show :: String *File -> *File
+ show :: Expr *File -> *File
show s f = f <<< s
options = [ Option ['i'] ["infile"]