Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

Stack Virtual Machine

A minimal stack-based process virtual machine written in Python.

  • Arithmetic Operations: ADD, SUB, MUL, DIV, MOD, NEG
  • Stack Operations: PUSH, POP, DUP, SWAP
  • Comparisons: EQ, ST, GT
  • Control Flow: JMP, JZ, JNZ
  • PRINT, HALT

Usage

chmod +x ./vm.py
./vm.py <program>

Specifics

I implemented a simple parser to be able to write code in files and execute them inside the VM.

Lines starting with a semicolon (;) will be treated as comments.

Programs must end with a HALT instruction.

TODO

  • Finish replacing OPCODES with real bytecode
  • Add memory
  • Implement CALL and RET operations
  • Add a call stack

About

Process virtual machine written in Python.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages