mirror of
https://github.com/anoma/juvix.git
synced 2024-12-21 13:51:38 +03:00
2d798ec31c
* Depends on PR #1824 * Closes #1556 * Closes #1825 * Closes #1843 * Closes #1729 * Closes #1596 * Closes #1343 * Closes #1382 * Closes #1867 * Closes #1876 * Changes the `juvix compile` command to use the new pipeline. * Removes the `juvix dev minic` command and the `BackendC` tests. * Adds the `juvix eval` command. * Fixes bugs in the Nat-to-integer conversion. * Fixes bugs in the Internal-to-Core and Core-to-Core.Stripped translations. * Fixes bugs in the RemoveTypeArgs transformation. * Fixes bugs in lambda-lifting (incorrect de Bruijn indices in the types of added binders). * Fixes several other bugs in the compilation pipeline. * Adds a separate EtaExpandApps transformation to avoid quadratic runtime in the Internal-to-Core translation due to repeated calls to etaExpandApps. * Changes Internal-to-Core to avoid generating matches on values which don't have an inductive type. --------- Co-authored-by: Paul Cadman <git@paulcadman.dev> Co-authored-by: janmasrovira <janmasrovira@gmail.com>
97 lines
2.8 KiB
Haskell
97 lines
2.8 KiB
Haskell
module Commands.Dev.Core.Options where
|
|
|
|
import Commands.Dev.Core.Asm.Options
|
|
import Commands.Dev.Core.Compile.Options
|
|
import Commands.Dev.Core.Eval.Options
|
|
import Commands.Dev.Core.FromConcrete.Options
|
|
import Commands.Dev.Core.Read.Options
|
|
import Commands.Dev.Core.Repl.Options
|
|
import Commands.Dev.Core.Strip.Options
|
|
import CommonOptions
|
|
|
|
data CoreCommand
|
|
= Repl CoreReplOptions
|
|
| Eval CoreEvalOptions
|
|
| Read CoreReadOptions
|
|
| FromConcrete CoreFromConcreteOptions
|
|
| Strip CoreStripOptions
|
|
| CoreAsm CoreAsmOptions
|
|
| CoreCompile CompileOptions
|
|
deriving stock (Data)
|
|
|
|
parseCoreCommand :: Parser CoreCommand
|
|
parseCoreCommand =
|
|
hsubparser $
|
|
mconcat
|
|
[ commandRepl,
|
|
commandEval,
|
|
commandRead,
|
|
commandStrip,
|
|
commandFromConcrete,
|
|
commandAsm,
|
|
commandCompile
|
|
]
|
|
where
|
|
commandRepl :: Mod CommandFields CoreCommand
|
|
commandRepl = command "repl" replInfo
|
|
|
|
commandEval :: Mod CommandFields CoreCommand
|
|
commandEval = command "eval" evalInfo
|
|
|
|
commandRead :: Mod CommandFields CoreCommand
|
|
commandRead = command "read" readInfo
|
|
|
|
commandStrip :: Mod CommandFields CoreCommand
|
|
commandStrip = command "strip" stripInfo
|
|
|
|
commandAsm :: Mod CommandFields CoreCommand
|
|
commandAsm = command "asm" asmInfo
|
|
|
|
commandFromConcrete :: Mod CommandFields CoreCommand
|
|
commandFromConcrete = command "from-concrete" fromSourceInfo
|
|
|
|
commandCompile :: Mod CommandFields CoreCommand
|
|
commandCompile = command "compile" compileInfo
|
|
|
|
replInfo :: ParserInfo CoreCommand
|
|
replInfo =
|
|
info
|
|
(Repl <$> parseCoreReplOptions)
|
|
(progDesc "Start an interactive session of the JuvixCore evaluator")
|
|
|
|
fromSourceInfo :: ParserInfo CoreCommand
|
|
fromSourceInfo =
|
|
info
|
|
(FromConcrete <$> parseCoreFromConcreteOptions)
|
|
(progDesc "Read a Juvix file and compile it to core")
|
|
|
|
evalInfo :: ParserInfo CoreCommand
|
|
evalInfo =
|
|
info
|
|
(Eval <$> parseCoreEvalOptions)
|
|
(progDesc "Evaluate a JuvixCore file and pretty print the result")
|
|
|
|
readInfo :: ParserInfo CoreCommand
|
|
readInfo =
|
|
info
|
|
(Read <$> parseCoreReadOptions)
|
|
(progDesc "Read a JuvixCore file, transform it, and pretty print it")
|
|
|
|
stripInfo :: ParserInfo CoreCommand
|
|
stripInfo =
|
|
info
|
|
(Strip <$> parseCoreStripOptions)
|
|
(progDesc "Translate a JuvixCore file to Core.Stripped and pretty print the result")
|
|
|
|
asmInfo :: ParserInfo CoreCommand
|
|
asmInfo =
|
|
info
|
|
(CoreAsm <$> parseCoreAsmOptions)
|
|
(progDesc "Translate a JuvixCore file to JuvixAsm and run the result")
|
|
|
|
compileInfo :: ParserInfo CoreCommand
|
|
compileInfo =
|
|
info
|
|
(CoreCompile <$> parseCompileOptions parseInputJuvixCoreFile)
|
|
(progDesc "Compile a JuvixCore file to native code, WebAssembly or GEB")
|