1
1
mirror of https://github.com/anoma/juvix.git synced 2024-12-13 11:16:48 +03:00
juvix/test
Jan Mas Rovira 2d36a65324
Make compile targets a subcommand instead of a flag (#2700)
# Changes
The main goal of this pr is to remove the `--target` flag for `juvix
compile` and use subcommands instead. The targets that are relevant to
normal users are found in `juvix compile --help`. Targets that are
relevant only to developers are found in `juvix dev compile --help`.

Below I list some of the changes in more detail.
## Compile targets for user-facing languages
- `juvix compile native`
- `juvix compile wasi`. I wasn't sure how to call this: `wasm`,
`wasm32-wasi`, etc. In the end I thought `wasi` was short and accurate,
but we can change it.
- `juvix compile vampir`
- `juvix compile anoma`
- `juvix compile cairo`
## *New* compile targets for internal languages
See `juvix dev compile --help`.

1. `dev compile core` has the same behaviour as `dev core
from-concrete`. The `dev core from-concrete` is redundant at the moment.
2. `dev compile tree` compiles to Tree and prints the InfoTable to the
output file wihout any additional checks.
3. `dev compile reg` compiles to Reg and prints the InfoTable to the
output file wihout any additional checks.
4. `dev compile asm` compiles to Asm and prints the InfoTable to the
output file wihout any additional checks.
5. 4. `dev compile casm` compiles to Asm and prints the Result to the
output file wihout any additional checks. TODO: should the Result be
printed or something else? At the moment the Result lacks a pretty
instance.
6. 
## Optional input file
1. The input file for commands that expect a .juvix file as input is now
optional. If the argument is ommited, he main file given in the
package.yaml will be used. This applies to the following commands:
   1. `juvix compile [native|wasi|geb|vampir|anoma|cairo]`
   8.  `juvix dev compile [core|reg|tree|casm|asm]`
   1. `juvix html`
   3. `juvix markdown`.
   4. `juvix dev internal [typecheck|pretty]`.
   5. `juvix dev [parse|scope]`
   7. `juvix compile [native|wasi|geb|vampir|anoma|cairo]`
   9. note that `juvix format` has not changed its behaviour.

## Refactor some C-like compiler flags
Both `juvix compile native` and `juvix compile wasi` support `--only-c`
(`-C`), `--only-preprocess` (`-E`), `--only-assemble` (`-S`). I propose
to deviate from the `gcc` style and instead use a flag with a single
argument:
- `--cstage [source|preprocess|assembly|exec(default)]`. I'm open to
suggestions. For now, I've kept the legacy flags but marked them as
deprecated in the help message.

## Remove code duplication
I've tried to reduce code duplication. This is sometimes in tension with
code readability so I've tried to find a good balance. I've tried to
make it so we don't have to jump to many different files to understand
what a single command is doing. I'm sure there is still room for
improvement.

## Other refactors
I've implemented other small refactors that I considered improved the
quality of the code.

## TODO/Future work
We should refactor commands (under `compile dev`) which still use
`module Commands.Extra.Compile` and remove it.
2024-04-09 13:29:07 +02:00
..
Anoma Make compile targets a subcommand instead of a flag (#2700) 2024-04-09 13:29:07 +02:00
Asm Refactor readFile and some parsers to use Path instead of FilePath (#2649) 2024-02-19 17:33:58 +01:00
BackendGeb Make compile targets a subcommand instead of a flag (#2700) 2024-04-09 13:29:07 +02:00
BackendMarkdown Add flags for the markdown and html backend: --strip-prefix and --ext. (#2681) 2024-03-09 18:42:09 +01:00
Casm Support Cairo VM input hints (#2709) 2024-04-09 11:43:57 +02:00
Compilation Support nockma scry (#2678) 2024-03-21 16:44:14 +01:00
Core Add field element type (#2659) 2024-02-27 14:54:43 +01:00
Examples Run test suite in parallel (#2507) 2023-11-16 16:19:52 +01:00
Formatter Promote use of MonadIO to minimize embed occurrences (#2694) 2024-03-20 09:56:00 +01:00
Internal Refactor readFile and some parsers to use Path instead of FilePath (#2649) 2024-02-19 17:33:58 +01:00
Nockma Capture scry id in the main function and use it when compiling anomaGet (#2705) 2024-04-02 16:40:07 +01:00
Package Replace polysemy by effectful (#2663) 2024-03-21 12:09:34 +00:00
Parsing Fix typos (#2573) 2024-01-08 13:27:18 +01:00
Reg CASM serialization (#2679) 2024-03-26 17:18:52 +01:00
Repl Replace polysemy by effectful (#2663) 2024-03-21 12:09:34 +00:00
Resolver Fix typos (#2573) 2024-01-08 13:27:18 +01:00
Runtime Fix casm test failures due to concurrent calls to setCurrentDir (#2706) 2024-03-28 14:29:13 +00:00
Scope Correctly resolve the visibility annotations of NameSpaceEntries (#2657) 2024-02-16 18:26:01 +01:00
Termination Fix typos (#2573) 2024-01-08 13:27:18 +01:00
Tree Support nockma scry (#2678) 2024-03-21 16:44:14 +01:00
Typecheck Use the target of aliases when resolving name signatures and iterators (#2669) 2024-02-26 11:53:47 +00:00
VampIR Support compilation to Anoma compatible functions (#2652) 2024-02-23 12:54:22 +00:00
Anoma.hs Support compilation to Anoma compatible functions (#2652) 2024-02-23 12:54:22 +00:00
Asm.hs Translation from JuvixAsm to C (#1619) 2022-12-06 11:33:20 +01:00
BackendGeb.hs End-to-end Geb compilation tests (#1942) 2023-03-29 14:02:40 +02:00
BackendMarkdown.hs Add MarkdownInfo entry in Module Concrete Decl and proper errors (#2515) 2023-11-16 11:20:34 +01:00
Base.hs Replace polysemy by effectful (#2663) 2024-03-21 12:09:34 +00:00
Casm.hs JuvixReg to CASM translation (#2671) 2024-03-20 12:14:12 +01:00
Compilation.hs Remove old typechecker (#2545) 2023-12-01 16:50:37 +01:00
Core.hs Implement core transformation let-hoisting (#2076) 2023-05-16 13:42:44 +02:00
Examples.hs Add a test suite for milestone examples (#1920) 2023-03-24 13:16:26 +00:00
Format.hs Refactor readFile and some parsers to use Path instead of FilePath (#2649) 2024-02-19 17:33:58 +01:00
Formatter.hs Add juvix format command (#1886) 2023-03-29 15:51:04 +02:00
Internal.hs Add translation from Internal to Core (#1567) 2022-11-07 14:47:56 +01:00
Main.hs Update REPL artifacts with builtins from stored modules (#2639) 2024-02-26 16:19:04 +00:00
Nockma.hs Nockma compile (#2570) 2024-01-17 11:15:38 +01:00
Package.hs Use JuvixError instead of Text for errors in Package file loading (#2459) 2023-10-23 19:01:36 +01:00
Parsing.hs Disallow tab characters as spaces (#1523) 2022-09-07 13:59:41 +02:00
Reg.hs JuvixReg recursors (#2641) 2024-02-19 08:58:19 +00:00
Repl.hs Update REPL artifacts with builtins from stored modules (#2639) 2024-02-26 16:19:04 +00:00
Resolver.hs Per-module compilation (#2468) 2023-12-30 20:15:35 +01:00
Runtime.hs Juvix C runtime (#1580) 2022-11-03 09:38:09 +01:00
Scope.hs [ CI ] New jobs: ormolu and hlint 2022-04-05 19:57:21 +02:00
Termination.hs Add the termination checker to the pipeline (#111) 2022-05-30 13:40:52 +02:00
Tree.hs JuvixTree recursors and transformation framework (#2594) 2024-01-29 16:43:08 +00:00
Typecheck.hs Remove old typechecker (#2545) 2023-12-01 16:50:37 +01:00
VampIR.hs Check valid argument names in YAML (#2193) 2023-06-15 16:42:58 +02:00