25 lines
502 B
Haskell
25 lines
502 B
Haskell
|
module Main (main) where
|
||
|
|
||
|
import Control.Monad
|
||
|
import Data.Either
|
||
|
import Eval.Expression
|
||
|
import Objects.Expression
|
||
|
import Parser.Expression
|
||
|
import System.Environment
|
||
|
import LLVMGen.Expression
|
||
|
import System.IO
|
||
|
import Text.Megaparsec
|
||
|
|
||
|
getRight :: ParseResult -> Expr
|
||
|
getRight (Right r) = r
|
||
|
|
||
|
getResult :: String -> Int
|
||
|
getResult str = evalExpr (getRight (parseExpr str))
|
||
|
|
||
|
main = do
|
||
|
fileName <- fmap head getArgs
|
||
|
contents <- readFile fileName
|
||
|
let result = getResult contents
|
||
|
print result
|
||
|
getLLVM
|