From: Luke Lau Date: Sat, 18 May 2019 20:11:11 +0000 (+0100) Subject: Add basic repl X-Git-Url: https://git.lukelau.me/?p=kaleidoscope-hs.git;a=commitdiff_plain;h=3ccccc6ab809fb87dd929855936895fb11479e27 Add basic repl For the moment this doesn't have any parsing errors other than "Couldn't parse". We'll go back to this later! Also note we're printing to stderr. --- diff --git a/Main.hs b/Main.hs index 76a9bdb..ec0de8c 100644 --- a/Main.hs +++ b/Main.hs @@ -1 +1,10 @@ -main = pure () +import AST +import System.IO +import Text.Read +main = do + hPutStr stderr "ready> " + ast <- (readMaybe <$> getLine) :: IO (Maybe AST) + case ast of + Just x -> hPrint stderr x + Nothing -> hPutStrLn stderr "Couldn't parse" + main