summaryrefslogtreecommitdiff
path: root/hs/Main.hs
diff options
context:
space:
mode:
authorTom Smeding <tom@tomsmeding.com>2023-05-21 22:00:40 +0200
committerTom Smeding <tom@tomsmeding.com>2023-05-21 22:00:40 +0200
commit0ef6d707911b3cc57a0bee5db33a444237219c29 (patch)
tree0e0a8572924b5d944c77a32d962131a0fe5cbb75 /hs/Main.hs
parent164a8d297429d58d216b9fa44e0cb42db5d23e2c (diff)
Find old Haskell implementation on backup diskHEADmaster
GHC 8.0.2 vintage, doesn't compile
Diffstat (limited to 'hs/Main.hs')
-rw-r--r--hs/Main.hs26
1 files changed, 26 insertions, 0 deletions
diff --git a/hs/Main.hs b/hs/Main.hs
new file mode 100644
index 0000000..5db97ec
--- /dev/null
+++ b/hs/Main.hs
@@ -0,0 +1,26 @@
+module Main where
+
+import Control.Monad
+import System.Environment
+import System.Exit
+
+-- import AST
+import Interpreter
+import Parser
+
+
+main :: IO ()
+main = do
+ args <- getArgs
+ when (length args == 0) $ die "Pass source file as parameter"
+ let fname = head args
+ src <- readFile fname
+ let eprog = parseProgram (Just fname) src
+ prog <- either (die . show) return eprog
+ -- print prog
+ -- putStrLn $ astPretty prog
+ let (merr, output, _) = interpret prog
+
+ maybe (putStrLn "[No errors]") (putStrLn . ("ERROR: " ++)) merr
+ putStrLn "OUTPUT:"
+ putStrLn output