blob: 64a8a6f707e476494d473b1c1eae85fb251b3678 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
module Main where
import IO ( stdin, hGetContents )
import System ( getArgs, getProgName )
import LexSrc
import ParSrc
import SkelSrc
import PrintSrc
import AbsSrc
import Compile
import PrEnv
import ErrM
type ParseFun a = [Token] -> Err a
myLLexer = myLexer
runFile :: ParseFun Grammar -> FilePath -> IO ()
runFile p f = readFile f >>= run p
run :: ParseFun Grammar -> String -> IO ()
run p s = let ts = myLLexer s in case p ts of
Bad s -> do putStrLn "Parse Failed...\n"
putStrLn s
Ok tree -> prEnv $ compile tree
main :: IO ()
main = do args <- getArgs
case args of
fs -> mapM_ (runFile pGrammar) fs
|