summaryrefslogtreecommitdiff
path: root/src/Main.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Main.hs')
-rw-r--r--src/Main.hs17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/Main.hs b/src/Main.hs
index 9249638..226182a 100644
--- a/src/Main.hs
+++ b/src/Main.hs
@@ -1,4 +1,19 @@
module Main where
+import qualified Language.Fiddle.Tokenizer
+import qualified Data.Text.IO
+import qualified System.Environment as System
+import Control.Monad (forM_)
+
main :: IO ()
-main = putStrLn "Hello, World"
+main = do
+ argv <- System.getArgs
+
+ case argv of
+ [filePath] -> do
+ text <- Data.Text.IO.readFile filePath
+ case Language.Fiddle.Tokenizer.tokenize filePath text of
+ Left pe -> putStrLn $ "Parse Error: " ++ show pe
+ Right lst -> forM_ lst $ \(Language.Fiddle.Tokenizer.Token t _) -> print t
+
+ _ -> putStrLn "Wrong Args"