mirror of
https://github.com/anoma/juvix.git
synced 2025-01-01 12:06:57 +03:00
31 lines
1.1 KiB
Haskell
31 lines
1.1 KiB
Haskell
module Commands.Dev.Core.Compile where
|
|
|
|
import Commands.Base
|
|
import Commands.Dev.Core.Compile.Base
|
|
import Commands.Dev.Core.Compile.Options
|
|
import Juvix.Compiler.Core.Data.Module qualified as Core
|
|
import Juvix.Compiler.Core.Translation.FromSource qualified as Core
|
|
|
|
runCommand :: forall r. (Members '[EmbedIO, App, TaggedLock] r) => CompileOptions -> Sem r ()
|
|
runCommand opts = do
|
|
file <- getMainFile (Just (opts ^. compileInputFile))
|
|
s <- readFile file
|
|
tab <- getRight (Core.runParserMain file defaultModuleId mempty s)
|
|
let arg =
|
|
PipelineArg
|
|
{ _pipelineArgOptions = opts,
|
|
_pipelineArgModule = Core.moduleFromInfoTable tab
|
|
}
|
|
case opts ^. compileTarget of
|
|
AppTargetWasm32Wasi -> runCPipeline arg
|
|
AppTargetNative64 -> runCPipeline arg
|
|
AppTargetVampIR -> runVampIRPipeline arg
|
|
AppTargetCore -> return ()
|
|
AppTargetAsm -> runAsmPipeline arg
|
|
AppTargetReg -> runRegPipeline arg
|
|
AppTargetTree -> runTreePipeline arg
|
|
AppTargetAnoma -> runAnomaPipeline arg
|
|
AppTargetCasm -> runCasmPipeline arg
|
|
AppTargetCairo -> runCairoPipeline arg
|
|
AppTargetRiscZeroRust -> runRiscZeroRustPipeline arg
|