Skip to content

Commit

Permalink
Modify loker.hs to dump parse tree and state
Browse files Browse the repository at this point in the history
  • Loading branch information
UnkindPartition committed Jun 15, 2010
1 parent 642beba commit efb92e6
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions loker.hs
Expand Up @@ -2,14 +2,18 @@ module Main where
import System.Environment
import System.Exit
import Parse
import Parsec (parse)
import Parsec

main = do
args <- getArgs
s <- if null args
then getContents
else readFile (head args)
let res = parse program (if null args then "" else head args) s
let program_and_state = do
p <- program
s <- getState
return (p,s)
let res = parse program_and_state (if null args then "" else head args) s
case res of
Right _ -> do putStrLn "OK"; exitSuccess
Right s -> do print s; exitSuccess
Left m -> do print m; exitFailure

0 comments on commit efb92e6

Please sign in to comment.