Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/canta-slaus/rusty-toy
A Rust port of the TOY machine simulator
https://github.com/canta-slaus/rusty-toy
rust simulator toy
Last synced: 3 days ago
JSON representation
A Rust port of the TOY machine simulator
- Host: GitHub
- URL: https://github.com/canta-slaus/rusty-toy
- Owner: canta-slaus
- License: mit
- Created: 2022-05-25T20:09:03.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-03-19T15:41:46.000Z (almost 2 years ago)
- Last Synced: 2023-09-07T20:27:53.539Z (over 1 year ago)
- Topics: rust, simulator, toy
- Language: Rust
- Homepage:
- Size: 15.6 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# TOY machine simulator
A Rust port of the TOY machine simulator, as described and explained by [Sedgewick and Wayne](https://www.comscigate.com/cs/IntroSedgewick/50machine/52toy/index.html). Their original implementation can be found at [Toy.java](https://www.comscigate.com/cs/IntroSedgewick/50machine/55simulator/index.html).
All of their provided [examples](https://www.comscigate.com/cs/IntroSedgewick/50machine/54programming/index.html) work as intended and can be found in the `examples` folder.
The simplest example is [`add.toy`](https://www.comscigate.com/cs/IntroSedgewick/50machine/54programming/add.toy):
```
// add.toy
// Input: Stored in memory location 00 and 01
// Output: Sum of two integers saved in memory location 02
// https://www.comscigate.com/cs/IntroSedgewick/50machine/54programming/add.toy00: 0008 8
01: 0005 510: 8A00 R[A] <- mem[00]
11: 8B01 R[B] <- mem[01]
12: 1CAB R[C] <- R[A] + R[B]
13: 9C02 mem[02] <- R[C]
14: 0000 halt
```To run the simulator:
```
$ cargo run examples/add.toy
```