https://github.com/hellerve/zvm
A useless register-based virtual machine in zepto
https://github.com/hellerve/zvm
Last synced: 26 days ago
JSON representation
A useless register-based virtual machine in zepto
- Host: GitHub
- URL: https://github.com/hellerve/zvm
- Owner: hellerve
- License: unlicense
- Created: 2016-01-29T14:33:32.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2016-05-23T12:56:53.000Z (almost 10 years ago)
- Last Synced: 2025-04-05T22:43:40.742Z (12 months ago)
- Size: 4.88 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# zvm
A minimal register-based virtual machine in zepto.
## Usage
This virtual machine takes a minimal, assembler-esque
language, compiles it to byte-code and runs it on a
register machine.
An example script can be found in the `examples/` dir.
The result of all the opcodes are saved in the first register
specified.
The opcodes that are understood are
- noop: does nothing
- set: sets a register
- add: adds two registers
- sub: substracts two registers
- mul: multiplies two registers
- div: divide two registers from each other
- print: print the contents of one register
- and: bitwise and on two registers
- or: bitwise or on two registers
- not: bitwise negation of a register
I made sure no useful programming is possible.
If you want to try it out and have zepto installed
(*why would you have that?*), you can just run:
```sh
zepto vm-cli.zp somevmfile
```
## Why
Simple: Because I've never written a register-based
virtual machine before and I wanted to try it out.
Have fun!