This repository has been archived on 2024-04-05. You can view files and clone it, but cannot push or open issues/pull-requests.
really-bad-compiler-in-haskell/main/Main.hs

25 lines
502 B
Haskell
Raw Normal View History

2023-09-08 03:57:12 +00:00
module Main (main) where
2023-09-08 06:31:07 +00:00
import Control.Monad
2023-09-08 05:53:11 +00:00
import Data.Either
import Eval.Expression
import Objects.Expression
import Parser.Expression
2023-09-08 04:04:01 +00:00
import System.Environment
2023-09-22 21:38:17 +00:00
import LLVMGen.Expression
2023-09-08 06:31:07 +00:00
import System.IO
2023-09-08 03:57:12 +00:00
import Text.Megaparsec
2023-09-07 22:24:45 +00:00
2023-09-08 05:53:11 +00:00
getRight :: ParseResult -> Expr
getRight (Right r) = r
2023-09-08 06:31:07 +00:00
getResult :: String -> Int
getResult str = evalExpr (getRight (parseExpr str))
2023-09-08 05:53:11 +00:00
2023-09-08 03:57:12 +00:00
main = do
2023-09-08 06:31:07 +00:00
fileName <- fmap head getArgs
contents <- readFile fileName
let result = getResult contents
print result
2023-09-22 21:38:17 +00:00
getLLVM