Following requirements must be met in order to compile and run Viua VM.
64 bit x86 is supported. 64 bit ARM should also work. Compiling and running Viua VM on 32 bit hardware is not tested.
Development and testing is performed on Linux with GNU toolchain. Various *BSD flavours should also work. In general, Viua VM should be capable of running on any UNIX-like operating system.
Microsoft Windows operating systems are not supported.
Following tools should be available on the system to support compilation and development of the VM.
Build scripts depend on GNU Make.
Valgrind is used to test memory usage and ensure that the machine does not leak.
VM's test suite depends on Python 3.
Viua VM uses Git as the version control software.
Viua VM requires a reasonably up-to-date C++ compiler supporting C++17. Both GCC (version 7 and later, 6 may also suffice but is no longer tested) and Clang (5 and later) are supported.
Assuming all requirements are met, below steps should give you a working Viua VM.
To honour the decades-old tradition, this is the first program one should write in a new language. Here is how to compile and run the "Hello World!" program on Viua VM.
Open an editor and copy the code presented below to a file.
Lines beginning with
-- are comments and may be omitted.
Everything else must be copied verbatim.
The source code has to be compiled into bytecode before the VM can run it.
Assembler is located at
./build/bin/vm/asm, relative to the main repository directory.
VM kernel is located at
./build/bin/vm/kernel, relative to the main repository directory.
You can run the compiled file through a disassembler. This is an optional step - disassembling is mentioned here for the curious individuals who may be interested in the fact that disassembly capabilities are provided out-of-the-box. In the example below the disassembler is run with some options that make it produce more verbose output.
The resulting output should be similar to the one presented below (assuming you did not modify the example code to print, for example, "Hello Joe!").