File tree Expand file tree Collapse file tree 4 files changed +268
-160
lines changed
Expand file tree Collapse file tree 4 files changed +268
-160
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ import Control.Monad.Except
77import qualified LLVM.AST as AST
88import Parser
99import Lexer
10+ import Emit
1011
1112firstModule :: AST. Module
1213firstModule = AST. defaultModule { AST. moduleName = " First Module" }
@@ -21,6 +22,7 @@ eval mod source = do
2122 Left err -> print err >> return Nothing
2223 Right ex -> do
2324 print ex
25+ ast <- codegen mod [ex]
2426 return $ Just mod
2527
2628repl :: IO ()
@@ -35,14 +37,7 @@ repl = runInputT defaultSettings (loop firstModule)
3537 case wrappedMod of
3638 Just modn -> loop modn
3739 Nothing -> loop mod
38- -- Just input -> do
39- -- let tree = (parse commandParser "Term" input) in
40- -- loop mod
41- -- case (parse commandParser "sdf" inputCode) of
42- -- Left mess -> outputStrLn mess
43- -- Right out -> outputStrLn out
44- -- outputStrLn (parse commandParser "sdf" inputCode)
45- -- repl
40+
4641
4742liftError :: ExceptT String IO a -> IO a
4843liftError = runExceptT >=> either fail return
Original file line number Diff line number Diff line change @@ -78,7 +78,7 @@ data Op
7878 | Minus
7979 | Mul
8080 | Divide
81- deriving (Show ,Eq , Ord )
81+ deriving (Show , Ord , Eq )
8282
8383data Type
8484 = IntC
You can’t perform that action at this time.
0 commit comments