The example code of Understanding Computation, an O’Reilly book about computation theory. Re-implement by language Rust.
Use
cargo build
to build the code.
- Chapter 2: The Meaning of Programs
- Chapter 3: The Simplest Computers
- Chapter 4: Just Add Power
- Chapter 5: The Ultimate Machine
- Chapter 6: Programming with Nothing
- Chapter 7: Universality is Everywhere
- Chapter 8: Not planning to implement this chapter.
- Chapter 9: Programming in Toyland
Most of the example code is implemented in testing form, you can find them in mod.rs. To view the test result, use following command:
RUST_TEST_THREADS=1 cargo test -- --nocapture
You can specify keyword in testing name in the command line.
For example:
$ RUST_TEST_THREADS=1 cargo test -- --nocapture ski_swap
running 1 test
test universality_is_everywhere::ski_calculus::tests::test_ski_swap ... swap: S[K[S[I]]][K]
S[K[S[I]]][K][x][y]
K[S[I]][x][K[x]][y]
S[I][K[x]][y]
I[y][K[x][y]]
y[K[x][y]]
y[x]
ok
If you find any bugs or other programs with the code, please open an issue.