summaryrefslogtreecommitdiff
path: root/Main.hs
diff options
context:
space:
mode:
authorTom Smeding <tom.smeding@gmail.com>2018-03-26 21:34:51 +0200
committerTom Smeding <tom.smeding@gmail.com>2018-03-26 21:34:51 +0200
commit0e1f435314b382cb78056f04d0997df43e4f8fcf (patch)
tree8195b40c448cbbafc868a9727b6e1c218f26ca00 /Main.hs
parentc25979b76c1dd22b6dc33acb994e9044c56a68f9 (diff)
Rename files for case-sensitive file system
Diffstat (limited to 'Main.hs')
-rw-r--r--Main.hs29
1 files changed, 29 insertions, 0 deletions
diff --git a/Main.hs b/Main.hs
new file mode 100644
index 0000000..b56edfe
--- /dev/null
+++ b/Main.hs
@@ -0,0 +1,29 @@
+module Main where
+
+import System.Environment
+import System.Exit
+
+import Compiler
+import Optimiser
+import Parser
+import VM
+
+
+usage :: IO ()
+usage = do
+ progname <- getProgName
+ putStrLn $ "Usage: " ++ progname ++ " [filename.lisp]"
+
+main :: IO ()
+main = do
+ clargs <- getArgs
+ source <- case clargs of
+ [] -> getContents
+ [fname] -> readFile fname
+ _ -> usage >> exitFailure
+
+ prog <- parseProgram source >>= either (die . show) return
+ irprog <- either die return (compileProgram prog)
+ let opt = optimise irprog
+ -- print opt
+ vmRun opt