https://github.com/githubprankster/sock
The reasonably usable 16 instruction bytecode vm.
https://github.com/githubprankster/sock
bytecode-virtual-machine bytecode-vm c challenge-project minimal
Last synced: 6 months ago
JSON representation
The reasonably usable 16 instruction bytecode vm.
- Host: GitHub
- URL: https://github.com/githubprankster/sock
- Owner: GithubPrankster
- License: mit
- Created: 2020-05-21T20:27:19.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-05-21T20:48:44.000Z (over 5 years ago)
- Last Synced: 2025-01-23T11:34:22.396Z (about 1 year ago)
- Topics: bytecode-virtual-machine, bytecode-vm, c, challenge-project, minimal
- Language: C
- Homepage:
- Size: 12.7 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Stochastically Observed Computing Kaleidoscope
Sock is a bytecode vm that features just enough to be able to do "meaningful" computing of things. Constructed entirely in C,
using 4 standard libraries and in around ~140 LOC.
## Compilation & Duration
`gcc -static -march=native -mtune=native -s sock.c -o sock`
As compiled with GCC 10.0.1, `bdver2` architecture, 16GB RAM, running `time ./sock test.sock` yielded:
```
real 0m0.042s
user 0m0.015s
sys 0m0.015s
```
## The Features
* 16 instructions
* 2048 bytes of memory
* 4 8-bit registers
* Subroutine support (only 1 level)
* Around 4 modes of operation (number, register, memory, memory number, and some mixing)
* VM halting through exploitation of return instruction (0a, turned to 3a will halt operation)
* File reading
* Jumping, program self-modification potential
## In Action

### But why?
I challenged myself to write this in one day. I love this sorta stuff xD