import ast
import check
import int
+import gen
chars :: *File -> ([Char], *File)
chars f
# (cs,f) = chars f
= ([c:cs], f)
-:: Mode = MHelp | MLex | MParse | MType | MInterpret
+:: Mode = MHelp | MLex | MParse | MType | MInterpret | MGen
:: Result
= Lex [Token]
| Parse AST
- | Type (Type, AST)
+ | Type AST
| Interpret Value
+ | Gen [String]
options :: [OptDescr (Mode->Mode)]
options =
, Option ['p'] ["parse"] (NoArg (const MParse)) "Up to and including parse"
, Option ['t'] ["type"] (NoArg (const MType)) "Up to and including typing"
, Option ['i'] ["interpret"] (NoArg (const MInterpret)) "Up to and including interpretation"
+ , Option ['g'] ["gen"] (NoArg (const MInterpret)) "Up to and including generation"
]
Start :: *World -> Either [String] Result
MLex = Lex <$> lex cs
MParse = Parse <$> (lex cs >>= parse)
MType = Type <$> (lex cs >>= parse >>= check)
- MInterpret = Interpret <$> (lex cs >>= parse >>= check >>= int o snd)
+ MInterpret = Interpret <$> (lex cs >>= parse >>= check >>= int)
+ MGen = Gen <$> (lex cs >>= parse >>= check >>= gen)