Skip to content
/ SVM Public

Simple stack based virtual machine with its own simple bytecode

Notifications You must be signed in to change notification settings

Tervicke/SVM

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

simple stack based Virtual machine

build

clone the repo and fire the make command

changing the program

to change the program edit the
int program[] = {
PSH, 15,
PSH, 3,
DIV,
HLT,
//the stack pointer must pointing to value 5 
};

Note the program is array so dont forget to put , after every instructions

instruction set

Operation Description
PSH pushes the value to the top of the stack
POP pops the value , now the stack pointer points to the previous value
ADD Adds the the top two values and pushes them
SUB substracts the the second value from the previous
MUL multiples top two values on the stack
Div divides the top value by the first second top value
AND does the binary AND operation and on the top two value
OR does the binary OR operation and on the top two value
HLT Marks the end of the program

About

Simple stack based virtual machine with its own simple bytecode

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published