#vm #hack #assembly #translator #translation #machine #command

bin+lib vm_translator

A VM translator for the hack machine (ref: The Element Of Compting System)

3 releases

new 0.1.2 Apr 17, 2024
0.1.1 Apr 16, 2024
0.1.0 Jan 21, 2024

#2 in #hack

MIT license

22KB
801 lines

Hack machine VM Translator

Description

This is a vm translator written in rust to facilitate the translation of the supported vm command to its associated Hack's assembly instruction.

I have ensured the translator documents each processed command to make debugging easier.

Usage

git clone --depth=1 --no-checkout https://github.com/xpanvictor/hack/ && cd hack && git sparse-checkout set software/vm_translator && git checkout
cd software/vm_translator
cargo run <VM_FILE_PATH.vm>

Where
VM_FILE_PATH.vm: a path leading to file to translate

NOTE
The output file is stored in VM_FILE_PATH.asm.


lib.rs:

VM TRanslator

Does the job of translating using the other modules

Dependencies

~0.7–1.2MB
~26K SLoC