No description
This repository has been archived on 2026-05-14. You can view files and clone it, but you cannot make any changes to its state, such as pushing and creating new issues, pull requests or comments.
  • C++ 93.7%
  • Makefile 6.3%
Find a file
2018-07-14 18:21:05 +02:00
bin Working compiler for 1:1 representation 2018-07-13 21:09:31 +02:00
examples Fix remaining .h 2018-07-14 18:21:05 +02:00
vm C++ naming convention 2018-07-14 14:38:58 +02:00
.gitignore Working compiler for 1:1 representation 2018-07-13 21:09:31 +02:00
compiler.cpp Fix remaining .h 2018-07-14 18:21:05 +02:00
Makefile Fibonacci sequence example 2018-07-14 14:36:42 +02:00
README.md Fibonacci sequence example 2018-07-14 14:36:42 +02:00
runtime.cpp Fix remaining .h 2018-07-14 18:21:05 +02:00

PVM

paweljw's virtual machine.

What?

This project includes:

  • a runtime for a stack-based VM, sporting a whopping 21 opcodes,
  • a compiler for a super-rudimentary (meaning, almost opcode-like) language to a binary format understood by runtime (but at least it has labels now),
  • a couple of examples of using the language,
  • absolutely no procedures (though they can be implemented after a fashion) or global memory except for sixteen registers.

Usage

$ make
$ make examples
$ bin/runtime hello_world.pvm
$ bin/runtime fizzbuzz.pvm

Compiling a script:

$ bin/compiler script.pvs output.pvm

Debugging

TODO

  • Question my Friday evening pastimes.
  • Implement a better language on top of the VM (it would be so nice if I didn't have to push strings backwards).
  • A header in the binary file, specifying e.g. entrypoint (currently assumed to be instruction 0).
  • Global memory (but aren't registers fun?)
  • Procedure calls (yeah, right).