Skip to content

Commit

Permalink
Merge pull request #630 from bhavik-goplani/dev
Browse files Browse the repository at this point in the history
#620 Changed `bend run` to `bend run-rs` and `bend run` defaults to the C implementation
  • Loading branch information
developedby authored Jul 15, 2024
2 parents e239264 + 6380803 commit 060239a
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 8 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ and this project does not currently adhere to a particular versioning scheme.
- Add repeated field name error message.
- Add `Math` builtin functions. ([#570][gh-570])
- Add primitive file IO function `IO/FS/flush`. ([#598][gh-598])
- Changed `bend run` to `bend run-rs` and `bend run` defaults to the C implementation. ([#620][gh-620])

## [0.2.35] - 2024-06-06

Expand Down Expand Up @@ -393,5 +394,6 @@ and this project does not currently adhere to a particular versioning scheme.
[gh-596]: https://github.com/HigherOrderCO/Bend/issues/596
[gh-598]: https://github.com/HigherOrderCO/Bend/issues/598
[gh-618]: https://github.com/HigherOrderCO/Bend/issues/618
[gh-620]: https://github.com/HigherOrderCO/Bend/issues/620
[gh-623]: https://github.com/HigherOrderCO/Bend/issues/623
[Unreleased]: https://github.com/HigherOrderCO/Bend/compare/0.2.36...HEAD
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ bend --version
### Getting Started
#### Running Bend Programs
```sh
bend run <file.bend> # uses the Rust interpreter (sequential)
bend run <file.bend> # uses the C interpreter by default (parallel)
bend run-rs <file.bend> # uses the Rust interpreter (sequential)
bend run-c <file.bend> # uses the C interpreter (parallel)
bend run-cu <file.bend> # uses the CUDA interpreter (massively parallel)

Expand Down
12 changes: 7 additions & 5 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,9 @@ enum Mode {
path: PathBuf,
},
/// Compiles the program and runs it with the Rust HVM implementation.
Run(RunArgs),
RunRs(RunArgs),
/// Compiles the program and runs it with the C HVM implementation.
#[command(alias = "run")]
RunC(RunArgs),
/// Compiles the program and runs it with the Cuda HVM implementation.
RunCu(RunArgs),
Expand Down Expand Up @@ -282,8 +283,9 @@ fn execute_cli_mode(mut cli: Cli) -> Result<(), Diagnostics> {

let run_cmd = match &cli.mode {
Mode::RunC(..) => "run-c",
Mode::RunRs(..) => "run",
Mode::RunCu(..) => "run-cu",
_ => "run",
_ => "run-c",
};

match cli.mode {
Expand All @@ -307,9 +309,9 @@ fn execute_cli_mode(mut cli: Cli) -> Result<(), Diagnostics> {
println!("{}", hvm_book_show_pretty(&compile_res.hvm_book));
}

Mode::Run(RunArgs { pretty, run_opts, comp_opts, warn_opts, path, arguments })
| Mode::RunC(RunArgs { pretty, run_opts, comp_opts, warn_opts, path, arguments })
| Mode::RunCu(RunArgs { pretty, run_opts, comp_opts, warn_opts, path, arguments }) => {
Mode::RunC(RunArgs { pretty, run_opts, comp_opts, warn_opts, path, arguments })
| Mode::RunCu(RunArgs { pretty, run_opts, comp_opts, warn_opts, path, arguments })
| Mode::RunRs(RunArgs { pretty, run_opts, comp_opts, warn_opts, path, arguments }) => {
let CliRunOpts { linear, print_stats } = run_opts;

let diagnostics_cfg =
Expand Down
2 changes: 1 addition & 1 deletion tests/snapshots/cli__debug_list_map.bend.snap
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ error: unexpected argument '-d' found

tip: to pass '-d' as a value, use '-- -d'

Usage: bend run [OPTIONS] <PATH> [ARGUMENTS]...
Usage: bend run-c [OPTIONS] <PATH> [ARGUMENTS]...

For more information, try '--help'.
2 changes: 1 addition & 1 deletion tests/snapshots/cli__debug_u60_to_nat.bend.snap
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ error: unexpected argument '-d' found

tip: to pass '-d' as a value, use '-- -d'

Usage: bend run [OPTIONS] <PATH> [ARGUMENTS]...
Usage: bend run-c [OPTIONS] <PATH> [ARGUMENTS]...

For more information, try '--help'.

0 comments on commit 060239a

Please sign in to comment.