Skip to content
This repository has been archived by the owner on Oct 4, 2021. It is now read-only.
/ pvm Public archive

A (joke) VM with a rudimentary compiler and a runtime provider

Notifications You must be signed in to change notification settings

paweljw/pvm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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).

About

A (joke) VM with a rudimentary compiler and a runtime provider

Resources

Stars

Watchers

Forks

Packages

No packages published