https://github.com/deric-w/amn
Virtual machines for the AMN instructions sets
https://github.com/deric-w/amn
education python3 read-eval-print-loop repl virtual-machine
Last synced: about 1 month ago
JSON representation
Virtual machines for the AMN instructions sets
- Host: GitHub
- URL: https://github.com/deric-w/amn
- Owner: Deric-W
- License: gpl-3.0
- Created: 2022-08-22T18:04:37.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-11-20T02:55:34.000Z (6 months ago)
- Last Synced: 2025-03-24T22:48:16.062Z (about 2 months ago)
- Topics: education, python3, read-eval-print-loop, repl, virtual-machine
- Language: Python
- Homepage:
- Size: 73.2 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# AMN
[](https://github.com/pypa/hatch)

[](https://codecov.io/gh/Deric-W/AMN)The AMN package implements a simple virtual machine for the AM0 and AM1 instructions sets.
To use it, simply execute it with `python3 -m AMN -i exec path/to/file.txt` to execute the instructions written in a file.
If you want an interactive console just use `python3 -m AMN -i repl`.
## Requirements
Python >= 3.10 is required to use the utility.
## Installation
```sh
python3 -m pip install AMN
```## Examples
The REPL (read eval print loop) in action:
```
python3 -m AMN -i am0 repl
Welcome the the AM0 REPL, type 'help' for help
AM0 >> exec READ 0
Input: 8
AM0 >> exec READ 1
Input: 42
AM0 >> exec LOAD 0
AM0 >> exec LOAD 1
AM0 >> exec GT
AM0 >> exec JMC 24
AM0 >> status
Counter: 24
Stack: []
Memory:
0 := 8
1 := 42
AM0 >> exit
Exiting REPL...
```Example program which outputs the biggest of two numbers:
```
READ 0;
READ 1;
LOAD 0;
LOAD 1;
GT;
JMC 10;
LOAD 0;
STORE 2;
JMP 12;
LOAD 1;
STORE 2;
WRITE 2;
```