You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+113-9Lines changed: 113 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,40 +9,144 @@ Also included is the `kmir` tool, a python script that acts as a front-end to th
9
9
10
10
### KMIR Setup
11
11
12
-
Pre-requisites: `python >= 3.10`, `pip >= 20.0.2`, `poetry >= 1.3.2`, `gcc >= 11.4.0`, `cargo == nightly-2024-11-29`, `k >= v7.1.205`. To install K, follow the steps available in [K's Quick Start instructions](https://github.com/runtimeverification/k?tab=readme-ov-file#quick-start).
12
+
Pre-requisites: `python >= 3.10`, `pip >= 20.0.2`, `uv >= 0.7.11`, `gcc >= 11.4.0`, `cargo == nightly-2024-11-29`, `k >= v7.1.205`. To install K, follow the steps available in [K's Quick Start instructions](https://github.com/runtimeverification/k?tab=readme-ov-file#quick-start).
13
13
14
14
```bash
15
15
make build
16
16
```
17
17
18
18
Use `make` to run common tasks (see the [Makefile](Makefile) for a complete list of available targets).
19
19
20
-
For interactive use, spawn a shell with `poetry -C kmir/ shell` (after `poetry -C kmir/ install`), then run an interpreter. Or directly run from `mir-semantics` root with `poetry run -C kmir kmir <COMMAND>`
20
+
For interactive use, first sync the environment with `uv --directory kmir sync`, then either:
21
+
- Run Python directly: `uv --directory kmir run python`
22
+
- Activate the virtual environment: `source kmir/.venv/bin/activate` (on Unix/macOS) or `kmir\.venv\Scripts\activate` (on Windows)
23
+
- Or directly run commands from `mir-semantics` root: `uv --directory kmir run kmir <COMMAND>`
21
24
22
25
### Stable-MIR-JSON Setup
23
26
24
-
To interact with some of KMIR functionalities, it is necessary to provide the tool with a serialized JSON of a Rust program's Stable MIR. To be able to extract these serialized SMIR JSONs, you can use the `Stable-MIR-JSON` tool, setting it up with the following commands:
27
+
To interact with some of KMIR functionalities, it is necessary to provide the tool with a serialized JSON of a Rust program's Stable MIR. To be able to extract these serialized SMIR JSONs, you can use the `Stable-MIR-JSON` tool.
25
28
26
-
```Rust
29
+
#### Quick Start
30
+
```bash
27
31
git submodule update --init --recursive
28
32
make stable-mir-json
29
33
```
30
34
35
+
#### Generating SMIR JSON Files
36
+
37
+
After setting up stable-mir-json, you can generate SMIR JSON files from Rust source code:
For more information on testing, installation, and general usage of this tool, please check [Stable-MIR-JSON's repository](https://github.com/runtimeverification/stable-mir-json/).
32
60
33
61
## Usage
34
62
35
63
Use `--help` with each command for more details.
36
64
37
-
`parse` to parse a Stable MIR JSON file (`*.smir.json`) file to a K AST
65
+
### Basic Commands
66
+
67
+
**`kmir run`** - Execute a Rust program from SMIR JSON or directly from source
68
+
```bash
69
+
# Run from SMIR JSON file
70
+
uv --project kmir run kmir run --file path/to/program.smir.json
71
+
72
+
# Run with verbose output
73
+
uv --project kmir run kmir run --file path/to/program.smir.json --verbose
uv --project kmir run kmir prove-rs your_file.rs --verbose --proof-dir ./proof_dir
127
+
```
128
+
129
+
3.**View Results**:
130
+
```bash
131
+
uv --project kmir run kmir show proof_id --proof-dir ./proof_dir
132
+
uv --project kmir run kmir view proof_id --proof-dir ./proof_dir --verbose
133
+
```
38
134
39
-
`kmir run` to run a binary target in your cargo project (or a specific smir json provided with --file). The SMIR JSON will need to have been already built with `stable-mir-json`, or you will need the `RUSTC` environment variable set to your installation of `stable-mir-json`.
0 commit comments