It's an experimental emulator of a processor that understands π-calculus expressions, which is the formalism behind EO programming language.
To build it, install Rust and then:
If everything goes well, an executable binary will be in target/release/fibonacci
:
This will calculate the 7th Fibonacci number 40 times. Don't try to play with much larger numbers, this binary code is very slow. It's just an experiment.
To compile your own program instead of this primitive recursive Fibonacci calculator, you have to
convert EO code into π-calculus expressions and then pass them to Emu
struct like this:
use Emu;
This code is equivalent to the following EO code:
[] > foo
42 > x
x.add x > @
But in a more "functional" way:
[] > foo
42 > x
int-add > @
x
x
More tests are in src/emu.rs
file.
Run and fix Clippy lints issues before committing changes:
- Install Rustup. If Rustup was already installed, update to ensure have the latest Rustup and compiler.
- Install Clippy.
- Run Clippy.
- Automatically applying Clippy suggestions (Not all issues will be fixed automatically. Also, Clippy has some bugs with false-positive cases for some lints, so better to check automaticall fixes as well).