summaryrefslogtreecommitdiff
path: root/src/Main.hs
blob: 71734c4106b00935cedce2529f25b7253fde0ff3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
-- vim: et ts=2 sw=2 ai:
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
    lex' :: String -> Maybe [Token]
    lex' = lex

    result :: String -> Maybe (Either ParseError Program)
    result c = parse <$> lex c