diff options
author | Camil Staps | 2016-06-10 08:45:09 +0200 |
---|---|---|
committer | Camil Staps | 2016-06-10 08:45:09 +0200 |
commit | 09cf0f0791f8d05dbec240917e2010b161bb24f6 (patch) | |
tree | a5f5ac3d5f17d75bbe3171c3528307e81a9ec3d9 /run.icl | |
parent | LaTeX formatting for derivation trees (diff) |
Minimalistic prover
Diffstat (limited to 'run.icl')
-rw-r--r-- | run.icl | 15 |
1 files changed, 10 insertions, 5 deletions
@@ -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"] |