A toy version of Assembly, implemented in Rust.
Mostly designed for fun, this flavour of Assembly was made for Rust specifically. See /etc/DOCS.md
for a guide to use the language.
You can either build from source or through Docker
First, make sure you have Rust installed on your system. Then clone this repository into a local directory. You have two options: installing normal arsm, or arsm with inline python support.
run cargo install --path path/to/repository
.
Make sure you have Python3 installed on your system. Then, run cargo install --features inline-python --path path/to/repository
. Inline python can access the stack via the stk
variable and registers via the @
prefix, along with a few special functions
NOTE: Currently not included in the repo, needs fixing
Use the command node test
to test every case in ./test_cases
. A new case called N
can be created by:
- Creating
N.asm
, which is the program - Creating
N.in
, which is the input for the program - Creating
N.out
, which is the output the program should return ARSM performs all numeric checks at runtime. ARSM will only compile in release mode when using theinline-python
feature
Some simple programs written in arsm
str "Hello, World!" 10
.loop
chr #[eh]
inc eh
ceq db 0 10 eh
cjm :skip
jmp :loop
..skip
.loop
mov eh in
ceq eh 3
cjm :skip
chr eh
jmp :loop
..skip
cne in 49
cjm :skip
.loop
out 1
jmp :loop
..skip
out 0