Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
r28765@phanatique: nelhage | 2007-12-21 10:59:10 -0800
 add a 'repl' that isn't


git-svn-id: svn+ssh://lunatique.mit.edu/data/svn/flnv/trunk@33 e7f7c2cb-1e20-0410-8c26-a6ba679ee1f5
  • Loading branch information
nelhage committed Jul 25, 2008
1 parent 553abfb commit 3198820
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions Repl.hs
@@ -0,0 +1,25 @@
import FLNV.Expression
import FLNV.Parser
import FLNV.AST
import FLNV.Error
import System.IO
import System.Exit

runParser :: String -> IO Expression
runParser str = case (readExpr str :: Either Error Expression) of
Right expr -> return expr
Left err -> do putStrLn (show err)
exitWith $ ExitFailure 1

doDesugar :: Expression -> IO AST
doDesugar exp = do case (runDesugar $ desugar exp) of
(Left err) -> do putStrLn (show err)
exitWith $ ExitFailure 2
(Right ast) -> return ast

main :: IO ()
main = do prog <- getContents
expr <- runParser prog
ast <- doDesugar expr
putStrLn $ show ast
exitWith ExitSuccess

0 comments on commit 3198820

Please sign in to comment.