summaryrefslogtreecommitdiff
path: root/src/Main.hs
diff options
context:
space:
mode:
authorCamil Staps2018-02-07 12:30:29 +0100
committerCamil Staps2018-02-07 12:30:29 +0100
commit99cc59c2cd1c1b32c4c2bf57cb2168dcc94334a8 (patch)
tree549e96c3c004840f5bece425a9817c1fc4aa182a /src/Main.hs
parentAdd TArrow (diff)
Start with parser
Diffstat (limited to 'src/Main.hs')
-rw-r--r--src/Main.hs11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/Main.hs b/src/Main.hs
index 0356fee..71734c4 100644
--- a/src/Main.hs
+++ b/src/Main.hs
@@ -3,13 +3,20 @@ module Main where
import Prelude hiding(lex)
+import Text.Parsec.Error (ParseError)
+
import SPL.Syntax
import SPL.Lex
+import SPL.Parse
main :: IO ()
main = do
contents <- readFile "test/example1.spl"
+ putStrLn $ (show . lex') contents
putStrLn $ (show . result) contents
where
- result :: String -> Maybe [Token]
- result = lex
+ lex' :: String -> Maybe [Token]
+ lex' = lex
+
+ result :: String -> Maybe (Either ParseError Program)
+ result c = parse <$> lex c