Skip to content

Commit

Permalink
Add documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasstraub2 committed Jan 29, 2025
1 parent cfc2821 commit 39e2b55
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ examples/**/main
examples/**/*.c
examples/**/*.cu
.out.hvm
dots.js

# nix-direnv
/.direnv/
Expand Down
31 changes: 31 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,34 @@ don't worry, it isn't meant to. [Bend](https://github.com/HigherOrderCO/Bend) is
the human-readable language and should be used both by end users and by languages
aiming to target the HVM. If you're looking to learn more about the core
syntax and tech, though, please check the [PAPER](./paper/HVM2.pdf).
Interaction Net graph dumping and visualization
-----------------------------------------------
With the rust interpreter (`hvm run`), every evaluation step can be dumped with
the `--dump` command line option. You can dump in sequential mode (only one
redex is evaluated in each step) or, with the `--parallel` option,
in parallel mode (all redexes are evaluated in each step).
The dump will be written to the file `dots.js` in the current directory.
You can view the graph dump with `index.html` as follows:
Copy the file `dots.js` to the HVM directory. Then start a http server in the
HVM directory:
```sh
cd HVM
python3 -m http.server
```
Now you can visit `http://127.0.0.1:8000` and step through the graph with
the wasd keys on your keyboard.

How parallel is my Bend/HVM program?
------------------------------------

With the `--parallel` option, HVM also calculates the average number of regexes
in each step, thus giving a measurement of how parallel a given bend program is.

You can use the `--parallel` option without the `--dump` option as well.

0 comments on commit 39e2b55

Please sign in to comment.