mlem-asm 0.1.0

An assembler for the MLeM virtual machine.
Documentation
  • Coverage
  • 44.44%
    4 out of 9 items documented3 out of 6 items with examples
  • Size
  • Source code size: 25.88 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 4.06 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 19s Average build duration of successful builds.
  • all releases: 19s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Repository
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • NoraCodes

mlem-asm

Crates.io version badge Docs.rs version badge

This crate provides an assembler for the MLeM virtual machine. It assembles codes like this:

; a simple program that prints some ASCII characters
; from space to tilde
move L:96  R:R7     ; 0 Set the counter
move L:31  R:R0     ; 1 Set the initial value to output
add R:R0 L:1        ; 2 Increment the value to output
output R:R0         ; 3 Output that value
sub R:R7 L:1        ; 4 Update the counter
jnz L:2 R:R7        ; 5 Loop if the counter is not 0
halt                ; 6 Allow the program to complete successfully

This is, in fact, the contents of test.asm. The provided front-end in the examples directory can be used to assemble and run this program, thus:

14:38:41: leo [~/Projects/mlem-asm]
$ cargo run --example mlem-asm r ~/Projects/mlem-asm/test.asm
    Finished dev [unoptimized + debuginfo] target(s) in 0.0 secs
     Running `target/debug/examples/mlem-asm r /home/leo/Projects/mlem-asm/test.asm`
 !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
Halt