Skip to content
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

[sc-472] Allow passing arguments to program using a new CLI interface. #66

Merged
merged 12 commits into from
Feb 28, 2024

Conversation

FranchuFranchu
Copy link
Contributor

This PR adds a clap-based command-line-argument argument parser to hvm-core, adding the following features:

  • It modifies the run subcommand and allows it to take arguments that are then passed to the program. Arguments are passed using the lambda-calculus interpretation of interaction combinators, e.g. if the arguments are "#1" "#2" "#3", then the expression that will get reduced is r & @main ~ (#1 (#2 (#3 r)))
  • It adds a reduce subcommand that reduces a set of hvm-core expressions that are parsed directly from the command-line arguments, optionally loading a set of files. The expressions are reduced in the context of the loaded files.
  • It adds a -m flag to determine the amount of memory allocated by hvm-core.

The CLI interface is tested in tests/binary.rs

Copy link

src/encode.rs Outdated Show resolved Hide resolved
src/encode.rs Outdated Show resolved Hide resolved
@FranchuFranchu FranchuFranchu force-pushed the feature/sc-472/argument-passing branch from 0b659fc to 95b9a47 Compare February 27, 2024 19:14
src/host.rs Outdated Show resolved Hide resolved
src/host/encode.rs Outdated Show resolved Hide resolved
src/main.rs Outdated Show resolved Hide resolved
tests/binary.rs Outdated Show resolved Hide resolved
tests/programs/arithmetic.hvmc Outdated Show resolved Hide resolved
src/host/encode.rs Outdated Show resolved Hide resolved
@tjjfvi tjjfvi force-pushed the feature/sc-472/argument-passing branch from 53d0b78 to 0a8211b Compare February 27, 2024 21:56
@FranchuFranchu FranchuFranchu added this pull request to the merge queue Feb 28, 2024
Merged via the queue into main with commit 0ba064c Feb 28, 2024
5 checks passed
@FranchuFranchu FranchuFranchu deleted the feature/sc-472/argument-passing branch February 28, 2024 11:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants