~jojo/Carth

5f5c7f7873ca085f99c00ebb91359298cd84519c — JoJo 8 months ago 7492080
rename Optimize{,d} -> Low{er,}
12 files changed, 27 insertions(+), 27 deletions(-)

M app/Main.hs
M carth.cabal
M src/Codegen.hs
M src/Compile.hs
M src/Extern.hs
M src/Gen.hs
R src/{Optimized.hs => Low.hs}
A src/Lower.hs
D src/Optimize.hs
M src/Pretty.hs
M src/Selections.hs
M test/SystemSpec.hs
M app/Main.hs => app/Main.hs +5 -5
@@ 17,8 17,8 @@ import Conf
import GetConfig
import Compile
import Monomorphize
import Optimize
import qualified Optimized as Ast
import Lower
import qualified Low as Ast
import qualified Parse
import qualified Lex
import qualified Macro


@@ 70,9 70,9 @@ frontend cfg f = do
    verbose cfg ("   Monomorphizing")
    let mon = monomorphize ann
    when d $ writeFile ".dbg.mono" (show mon)
    let opt = optimize mon
    when d $ writeFile ".dbg.opt" (show opt)
    pure opt
    let low = lower mon
    when d $ writeFile ".dbg.low" (show low)
    pure low

lex :: FilePath -> IO [Lexd.TokenTree]
lex f = runExceptT (Lex.lex f) >>= \case

M carth.cabal => carth.cabal +2 -2
@@ 36,8 36,8 @@ library
      Misc
      Monomorphic
      Monomorphize
      Optimize
      Optimized
      Lower
      Low
      Lex
      Lexd
      Macro

M src/Codegen.hs => src/Codegen.hs +2 -2
@@ 28,8 28,8 @@ import Lens.Micro.Platform (use, assign, Lens', view)
import Misc
import SrcPos
import FreeVars
import qualified Optimized as Ast
import Optimized hiding (Type, Const)
import qualified Low as Ast
import Low hiding (Type, Const)
import TypeAst
import Selections
import Gen

M src/Compile.hs => src/Compile.hs +1 -1
@@ 30,7 30,7 @@ import Prelude hiding (mod)

import Misc
import Conf
import qualified Optimized as Ast
import qualified Low as Ast
import Codegen
import Err
import Pretty

M src/Extern.hs => src/Extern.hs +2 -2
@@ 33,8 33,8 @@ import Data.Functor

import Misc
import SrcPos
import qualified Optimized as Ast
import Optimized hiding (Type, Const)
import qualified Low as Ast
import Low       hiding (Type, Const)
import Gen



M src/Gen.hs => src/Gen.hs +2 -2
@@ 43,8 43,8 @@ import qualified LLVM.AST.FloatingPointPredicate as LLFPred
import Misc
import Pretty
import qualified TypeAst
import qualified Optimized as Ast
import Optimized (TypedVar(..), TPrim(..))
import qualified Low as Ast
import Low (TypedVar(..), TPrim(..))
import qualified Monomorphize
import SrcPos


R src/Optimized.hs => src/Low.hs +1 -1
@@ 1,3 1,3 @@
module Optimized (module Monomorphic) where
module Low (module Monomorphic) where

import Monomorphic

A src/Lower.hs => src/Lower.hs +7 -0
@@ 0,0 1,7 @@
module Lower (lower) where

import qualified Monomorphic
import Low

lower :: Monomorphic.Program -> Program
lower = id

D src/Optimize.hs => src/Optimize.hs +0 -7
@@ 1,7 0,0 @@
module Optimize (optimize) where

import qualified Monomorphic
import Optimized

optimize :: Monomorphic.Program -> Program
optimize = id

M src/Pretty.hs => src/Pretty.hs +1 -1
@@ 12,7 12,7 @@ import SrcPos
import qualified Lexd
import qualified Parsed
import qualified Inferred
import qualified Optimized as Ast
import qualified Low as Ast


-- Pretty print starting at some indentation depth

M src/Selections.hs => src/Selections.hs +1 -1
@@ 6,7 6,7 @@ import Data.Word
import Control.Monad

import Misc
import Optimized
import Low

type Selections a = Map Access a


M test/SystemSpec.hs => test/SystemSpec.hs +3 -3
@@ 19,8 19,8 @@ import qualified Parsed
import Check
import Compile
import Monomorphize
import Optimize
import qualified Optimized as Ast
import Lower
import qualified Low as Ast
import Conf

spec :: Spec


@@ 73,7 73,7 @@ compile' f =
frontend :: FilePath -> IO (Maybe Ast.Program)
frontend f = lexAndParse f <&> \case
    Nothing -> Nothing
    Just ast -> fmap (optimize . monomorphize) (rightToMaybe (typecheck ast))
    Just ast -> fmap (lower . monomorphize) (rightToMaybe (typecheck ast))

lexAndParse :: FilePath -> IO (Maybe Parsed.Program)
lexAndParse f = fmap rightToMaybe (runExceptT (lex' f >>= expandMacros' >>= parse''))