https://github.com/rft0/meow
Meow - The Purrfect Programming Language
https://github.com/rft0/meow
bytecode esoteric interpreter meow vm
Last synced: over 1 year ago
JSON representation
Meow - The Purrfect Programming Language
- Host: GitHub
- URL: https://github.com/rft0/meow
- Owner: rft0
- Created: 2025-03-12T14:36:25.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-12T15:26:12.000Z (over 1 year ago)
- Last Synced: 2025-03-12T15:34:58.131Z (over 1 year ago)
- Topics: bytecode, esoteric, interpreter, meow, vm
- Language: C
- Homepage:
- Size: 0 Bytes
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Meow - The Purrfect Programming Language
Meow is an esoteric language created for fun purposes and this repo contains bytecode interpreter for meow.
## Building
```
mkdir bin
make
```
## Usage
```
meow input.meow
```
## Instructions
Every meow instruction is 8-bit, first 3 bit represents operation type, last 5 represents
operation itself.
Meow instructions are encoded into two parts firstly `#m + #e - 2` gives us info about
type of instruction there are 4 types at total:
* **V-Type** (Operations to manipulate variables)
* **A-Type** (Arithmetic operations)
* **C-Type** (Control flow operations)
* **S-Type** (Operations that makes syscalls like printf)
We use `#o + #w - 2` to get information about second part of instruction.\
this part specifies which instruction we want ie:
* `meow` is decoded to `00000000` which is equilevant of `LOAD_CONST` in bytecode.
* `meoow` is decoded to `00000001` which is equilevant of `LOAD_VAR` in bytecode.
* `meeow` is decoded to `00100000` which is equilevant of `ADD` in bytecode.
* `mmeeoooww` is decoded to `01000101` which is equilevant of `JGE` in bytecode.
it is worthy to remind `meoow` and `meoww` generates same instruction.
You can find more information about instruction encodings at `src/lut.c`.
## Code Example
Here is an example to find nth fibonacci number in meow.
```
nyan main:
meow 4
meooww ~~n
meow 0
meow 1
meow 0
meooww ~~a
meooww ~~b
meooww ~~tmp
meoww ~~n
meow 0
mmeeow
mmeeooww base
meow 2
meooww ~~it_count
nyan fib_rec:
meoow ~~a
meoow ~~b
meeow
meooww ~~tmp
meoww ~~b
meooww ~~a
meoow ~~tmp
meooww ~~b
meoow ~~it_count
meow 1
mmeow
meooww ~~it_count
meoow ~~it_count
meoow ~~n
mmeeow
meeeooowwwwww fib_rec
mmeeoow fin
nyan base:
meow 0
meeeeow
meeeeoww
nyan fin:
meoww ~~n
meow ". Fibonacci number is "
meeow
meoww ~~b
meeow
meeeeow
```