-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make compile
targets a subcommand instead of a flag
#2700
Merged
Merged
Conversation
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
janmasrovira
force-pushed
the
compile-subcommands
branch
3 times, most recently
from
March 26, 2024 10:10
fc44851
to
3305409
Compare
lukaszcz
force-pushed
the
compile-subcommands
branch
from
March 26, 2024 16:19
3305409
to
785c855
Compare
janmasrovira
force-pushed
the
compile-subcommands
branch
3 times, most recently
from
March 27, 2024 12:08
40fb107
to
0b66bf4
Compare
janmasrovira
force-pushed
the
compile-subcommands
branch
7 times, most recently
from
April 3, 2024 11:14
b12cad9
to
7ba4105
Compare
janmasrovira
added a commit
to anoma/juvix-docs
that referenced
this pull request
Apr 4, 2024
janmasrovira
added a commit
to anoma/juvix-docs
that referenced
this pull request
Apr 4, 2024
lukaszcz
requested changes
Apr 4, 2024
janmasrovira
force-pushed
the
compile-subcommands
branch
from
April 8, 2024 13:05
652c389
to
b1a9594
Compare
lukaszcz
force-pushed
the
compile-subcommands
branch
from
April 9, 2024 08:39
e4f6f38
to
9e6708b
Compare
lukaszcz
approved these changes
Apr 9, 2024
lukaszcz
force-pushed
the
compile-subcommands
branch
from
April 9, 2024 09:49
9e6708b
to
65a69f9
Compare
janmasrovira
pushed a commit
that referenced
this pull request
Apr 10, 2024
The `--target` flag was replaced by subcommands in #2700 This PR fixes the benchmark suite to use `juvix compile native` and `juvix compile wasi`. In addition this PR adds as `compile-only` target to `juvix-bench` The compile-only target only compiles the executable for each variant of each suite. It doesn't actually run the benchmarks. This is useful when checking that the variant build steps are correct before committing. Example to run with stack: ``` stack bench --ba 'compile-only' ```
lukaszcz
pushed a commit
to anoma/juvix-stdlib
that referenced
this pull request
Apr 16, 2024
The `juvix compile` command was changed in anoma/juvix#2700. `juvix compile` must be updated to `juvix compile native`. This PR also updates the test Package lockfile which was not committed after that last dependency update.
This was referenced Apr 25, 2024
jonaprieto
pushed a commit
to anoma/juvix-docs
that referenced
this pull request
Jun 3, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changes
The main goal of this pr is to remove the
--target
flag forjuvix compile
and use subcommands instead. The targets that are relevant to normal users are found injuvix compile --help
. Targets that are relevant only to developers are found injuvix 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 thoughtwasi
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
.dev compile core
has the same behaviour asdev core from-concrete
. Thedev core from-concrete
is redundant at the moment.dev compile tree
compiles to Tree and prints the InfoTable to the output file wihout any additional checks.dev compile reg
compiles to Reg and prints the InfoTable to the output file wihout any additional checks.dev compile asm
compiles to Asm and prints the InfoTable to the output file wihout any additional checks.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.Optional input file
juvix compile [native|wasi|geb|vampir|anoma|cairo]
juvix dev compile [core|reg|tree|casm|asm]
juvix html
juvix markdown
.juvix dev internal [typecheck|pretty]
.juvix dev [parse|scope]
juvix compile [native|wasi|geb|vampir|anoma|cairo]
juvix format
has not changed its behaviour.Refactor some C-like compiler flags
Both
juvix compile native
andjuvix compile wasi
support--only-c
(-C
),--only-preprocess
(-E
),--only-assemble
(-S
). I propose to deviate from thegcc
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 usemodule Commands.Extra.Compile
and remove it.