Skip to content

Latest commit

 

History

History
27 lines (21 loc) · 1.5 KB

File metadata and controls

27 lines (21 loc) · 1.5 KB

Virtual Machines implementation for the course Virtual Machines (IN2040) - Summer 2025

CMa (C Machine)

The CMa is a virtual machine which executes instructions based on a C-like language.

Run instructions

In the Main class, you can specify the path to the .cma file with the program's instruction. The files used for testing are in the src/main/resources/cma directory.

When executing the main method, it outputs the top-most item from the stack into stdout.

MaMa (Functional Language Machine)

The MaMa is a virtual machines for instructions based on a functional language based on OCaml.

Run instructions

In the Main class, you can specify the path to the .mama file with the program's instruction. To create a MaMa virtual machine, you must use the .fromMaMaCodeFile static method from the Helpers class. This can be changed in the Main class. The files used for testing are in the src/main/resources/mama directory.

When executing the main method, it outputs the top-most item from the stack into stdout. If the top of the stack is a reference to a BasicValue in the heap, consider adding a getbasic instruction before halting to get the value of the reference on top of the stack. Otherwise, the program will only print the address of the value in the heap.

Debugging

I included a feature to debug and see the Virtual Machines' state after every instruction. To activate this, set the DEBUG constant in the corresponding class (CMa | MaMa) to TRUE. The state will get printed to stdout.