1
1
mirror of https://github.com/anoma/juvix.git synced 2024-12-15 18:13:56 +03:00
juvix/app/Commands/Dev/Core/Strip/Options.hs
Łukasz Czajka f2298bd674
JuvixCore to JuvixAsm translation (#1665)
An implementation of the translation from JuvixCore to JuvixAsm. After
merging this PR, the only remaining step to complete the basic
compilation pipeline (#1556) is the compilation of complex pattern
matching (#1531).

* Fixes several bugs in lambda-lifting.
* Fixes several bugs in the RemoveTypeArgs transformation.
* Fixes several bugs in the TopEtaExpand transformation.
* Adds the ConvertBuiltinTypes transformation which converts the builtin
bool inductive type to Core primitive bool.
* Adds the `juvix dev core strip` command.
* Adds the `juvix dev core asm` command.
* Adds the `juvix dev core compile` command.
* Adds two groups of tests: 
- JuvixCore to JuvixAsm translation: translate JuvixCore tests to
JuvixAsm and run the results with the JuvixAsm interpreter,
- JuvixCore compilation: compile JuvixCore tests to native code and WASM
and execute the results.
* Closes #1520 
* Closes #1549
2023-01-09 18:21:30 +01:00

31 lines
825 B
Haskell

module Commands.Dev.Core.Strip.Options where
import CommonOptions
import Juvix.Compiler.Core.Pretty.Options qualified as Core
data CoreStripOptions = CoreStripOptions
{ _coreStripShowDeBruijn :: Bool,
_coreStripNoPrint :: Bool,
_coreStripInputFile :: AppPath File
}
deriving stock (Data)
makeLenses ''CoreStripOptions
instance CanonicalProjection CoreStripOptions Core.Options where
project c =
Core.defaultOptions
{ Core._optShowDeBruijnIndices = c ^. coreStripShowDeBruijn
}
parseCoreStripOptions :: Parser CoreStripOptions
parseCoreStripOptions = do
_coreStripShowDeBruijn <- optDeBruijn
_coreStripNoPrint <-
switch
( long "no-print"
<> help "do not print the stripped code"
)
_coreStripInputFile <- parseInputJuvixCoreFile
pure CoreStripOptions {..}