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

22 lines
472 B
Haskell
Raw Normal View History

{-# LANGUAGE ImportQualifiedPost #-}
{-# LANGUAGE OverloadedStrings #-}
2023-09-08 03:57:12 +00:00
module Main (main) where
-- import Compiler.ExeGen
import Compiler.LLVMGen
import Data.Text.Lazy.IO qualified as T
import Parser.Expr
2023-09-08 04:04:01 +00:00
import System.Environment
import Types.Expr
2023-09-07 22:24:45 +00:00
2023-09-08 05:53:11 +00:00
getRight :: ParseResult -> Expr
getRight (Right r) = r
main :: IO ()
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 parsed = getRight (parseExpr contents)
T.putStrLn (llvmGen parsed)