created_at2023-10-07 20:06:11.491051
updated_at2023-12-31 01:47:00.954477
descriptionHVM-Core is a massively parallel Interaction Combinator evaluator.
Victor Taelin



# HVM-Core: a parallel Interaction Combinator evaluator HVM-Core is a parallel evaluator for extended [Symmetric Interaction Combinators](https://www-lipn.univ-paris13.fr/~mazza/papers/CombSem-MSCS.pdf). We provide a raw syntax for specifying nets and a Rust implementation that achieves up to **10 billion rewrites per second** on Apple M3 Max CPU. HVM's optimal evaluation semantics and concurrent model of computation make it a great compile target for high-level languages seeking massive parallelism. HVM-Core will be used as the compile target for [HVM](https://github.com/higherorderco/hvm) on its upcoming update. ## Usage Install HVM-Core as: ``` cargo install hvm-core ``` Then, run the interpeter as: ``` hvmc run file.hvmc -s ``` Or compile it to a faster executable: ``` hvmc compile file.hvmc ./file ``` Both versions will compute the program's normal form using all available cores. ## Example HVMC is a low-level compile target for high-level languages. It provides a raw syntax for wiring interaction nets. For example: ```javascript @add = (<+ a b> (a b)) @sum = (?<(#1 @sumS) a> a) @sumS = ({2 a b} c) & @add ~ (e (d c)) & @sum ~ (a d) & @sum ~ (b e) @main = a & @sum ~ (#24 a) ``` The file above implements a recursive sum. As you can see, its syntax isn't meant to be very human readable. Fortunatelly, we have [HVM-Lang](https://github.com/HigherOrderCO/hvm-lang), a tool that generates `.hvmc` files from a familiar functional syntax. On HVM-Lang, you can write instead: ```javascript add = λa λb (+ a b) sum = λn match n { 0 : 1 1+p : (add (sum p) (sum p)) } main = (sum 24) ``` Which compiles to the first program via `hvml compile main.hvm`. For more examples, see the [`/examples`](/examples) directory. If you do want to understand the hardcore syntax, keep reading. ## Language HVM-Core's textual syntax represents interaction combinators via an AST: ``` ::= ::= "*" ::= "(" " " ")" ::= "[" " " "]" ::= "{"
Commit count: 0

cargo fmt