1> module Main where 2> import System(getArgs) 3> import Data.Maybe(fromJust) 4> import FiniteMap(fmToList,lookupFM) 5> import Expr 6 7 8> main 9> = do 10> [s] <- getArgs 11> test s 12 13> test s 14> = do 15> case doParse $ map (:[]) $ lexer s of 16> ParseOK r f -> do 17> putStrLn $ "Ok " ++ show r ++ "\n" 18> ++ unlines (map show $ fmToList f) 19> ParseEOF f -> do 20> putStrLn $ "Premature end of input:\n" 21> ++ unlines (map show $ fmToList f) 22> ParseError ts f -> do 23> putStrLn $ "Error: " ++ show ts 24 25> forest_lookup f i 26> = fromJust $ lookupFM f i 27