-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 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 <[email protected]> Co-authored-by: janmasrovira <[email protected]>
- Loading branch information
1 parent
0f29b3e
commit 2d798ec
Showing
121 changed files
with
2,078 additions
and
1,609 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,77 +1,6 @@ | ||
module Commands.Compile.Options where | ||
module Commands.Compile.Options | ||
( module Commands.Extra.Compile.Options, | ||
) | ||
where | ||
|
||
import CommonOptions | ||
|
||
data CompileTarget | ||
= TargetC | ||
| TargetWasm | ||
| TargetNative | ||
deriving stock (Show, Data) | ||
|
||
data CompileRuntime | ||
= RuntimeWasiStandalone | ||
| RuntimeWasiLibC | ||
| RuntimeStandalone | ||
deriving stock (Show, Data) | ||
|
||
data CompileOptions = CompileOptions | ||
{ _compileTarget :: CompileTarget, | ||
_compileRuntime :: CompileRuntime, | ||
_compileOutputFile :: Maybe (AppPath File), | ||
_compileInputFile :: AppPath File | ||
} | ||
deriving stock (Data) | ||
|
||
makeLenses ''CompileOptions | ||
|
||
parseCompile :: Parser CompileOptions | ||
parseCompile = do | ||
_compileTarget <- | ||
option | ||
(eitherReader parseTarget) | ||
( long "target" | ||
<> short 't' | ||
<> metavar "TARGET" | ||
<> value TargetNative | ||
<> showDefaultWith targetShow | ||
<> help "select a target: wasm, c, native" | ||
) | ||
_compileRuntime <- | ||
option | ||
(eitherReader parseRuntime) | ||
( long "runtime" | ||
<> short 'r' | ||
<> metavar "RUNTIME" | ||
<> value RuntimeWasiStandalone | ||
<> showDefaultWith runtimeShow | ||
<> help "select a runtime: wasi-standalone, wasi-libc, standalone" | ||
) | ||
_compileOutputFile <- optional parseGenericOutputFile | ||
_compileInputFile <- parseInputJuvixFile | ||
pure CompileOptions {..} | ||
where | ||
parseTarget :: String -> Either String CompileTarget | ||
parseTarget = \case | ||
"wasm" -> Right TargetWasm | ||
"c" -> Right TargetC | ||
"native" -> Right TargetNative | ||
s -> Left $ "unrecognised target: " <> s | ||
|
||
targetShow :: CompileTarget -> String | ||
targetShow = \case | ||
TargetC -> "c" | ||
TargetWasm -> "wasm" | ||
TargetNative -> "native" | ||
|
||
parseRuntime :: String -> Either String CompileRuntime | ||
parseRuntime = \case | ||
"wasi-standalone" -> Right RuntimeWasiStandalone | ||
"wasi-libc" -> Right RuntimeWasiLibC | ||
"standalone" -> Right RuntimeStandalone | ||
s -> Left $ "unrecognised runtime: " <> s | ||
|
||
runtimeShow :: CompileRuntime -> String | ||
runtimeShow = \case | ||
RuntimeWasiStandalone -> "wasi-standalone" | ||
RuntimeWasiLibC -> "wasi-libc" | ||
RuntimeStandalone -> "standalone" | ||
import Commands.Extra.Compile.Options |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.