From 3ccccc6ab809fb87dd929855936895fb11479e27 Mon Sep 17 00:00:00 2001 From: Luke Lau Date: Sat, 18 May 2019 21:11:11 +0100 Subject: [PATCH] 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. --- Main.hs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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 -- 2.30.2