mirror of
https://github.com/anoma/juvix.git
synced 2025-01-01 12:06:57 +03:00
55598e0f95
* Implements code generation through Rust. * CLI: adds two `dev` compilation targets: 1. `rust` for generating Rust code 2. `native-rust` for generating a native executable via Rust * Adds end-to-end tests for compilation from Juvix to native executable via Rust. * A target for RISC0 needs to be added in a separate PR building on this one.
84 lines
2.1 KiB
Haskell
84 lines
2.1 KiB
Haskell
module Commands.Dev.DevCompile.Options where
|
|
|
|
import Commands.Dev.DevCompile.Asm.Options
|
|
import Commands.Dev.DevCompile.Casm.Options
|
|
import Commands.Dev.DevCompile.Core.Options
|
|
import Commands.Dev.DevCompile.NativeRust.Options
|
|
import Commands.Dev.DevCompile.Reg.Options
|
|
import Commands.Dev.DevCompile.Rust.Options
|
|
import Commands.Dev.DevCompile.Tree.Options
|
|
import CommonOptions
|
|
|
|
data DevCompileCommand
|
|
= Core (CoreOptions 'InputMain)
|
|
| Asm (AsmOptions 'InputMain)
|
|
| Reg (RegOptions 'InputMain)
|
|
| Tree (TreeOptions 'InputMain)
|
|
| Casm (CasmOptions 'InputMain)
|
|
| Rust (RustOptions 'InputMain)
|
|
| NativeRust (NativeRustOptions 'InputMain)
|
|
deriving stock (Data)
|
|
|
|
parseDevCompileCommand :: Parser DevCompileCommand
|
|
parseDevCompileCommand =
|
|
hsubparser
|
|
( mconcat
|
|
[ commandCore,
|
|
commandReg,
|
|
commandTree,
|
|
commandCasm,
|
|
commandAsm,
|
|
commandRust,
|
|
commandNativeRust
|
|
]
|
|
)
|
|
|
|
commandCore :: Mod CommandFields DevCompileCommand
|
|
commandCore =
|
|
command "core" $
|
|
info
|
|
(Core <$> parseCore)
|
|
(progDesc "Compile to Juvix Core")
|
|
|
|
commandReg :: Mod CommandFields DevCompileCommand
|
|
commandReg =
|
|
command "reg" $
|
|
info
|
|
(Reg <$> parseReg)
|
|
(progDesc "Compile to Juvix Reg")
|
|
|
|
commandTree :: Mod CommandFields DevCompileCommand
|
|
commandTree =
|
|
command "tree" $
|
|
info
|
|
(Tree <$> parseTree)
|
|
(progDesc "Compile to Juvix Tree")
|
|
|
|
commandCasm :: Mod CommandFields DevCompileCommand
|
|
commandCasm =
|
|
command "casm" $
|
|
info
|
|
(Casm <$> parseCasm)
|
|
(progDesc "Compile to Juvix Casm")
|
|
|
|
commandAsm :: Mod CommandFields DevCompileCommand
|
|
commandAsm =
|
|
command "asm" $
|
|
info
|
|
(Asm <$> parseAsm)
|
|
(progDesc "Compile to Juvix ASM")
|
|
|
|
commandRust :: Mod CommandFields DevCompileCommand
|
|
commandRust =
|
|
command "rust" $
|
|
info
|
|
(Rust <$> parseRust)
|
|
(progDesc "Compile to Rust")
|
|
|
|
commandNativeRust :: Mod CommandFields DevCompileCommand
|
|
commandNativeRust =
|
|
command "native-rust" $
|
|
info
|
|
(NativeRust <$> parseNativeRust)
|
|
(progDesc "Compile to native executable through Rust")
|