Bytebed is a bytebeat virtual machine designed for embedded systems like ESP32 and M5Stack Cardputer. It compiles bytebeat to bytecode and evaluates bytebeat functions on the fly.
The engine supports the classic C-style and stack-based notation for playing the bytebeat. All single expressions follow the common notation. Infix and postfix syntax be mirrored between standard C-like and stack-based notation (using TAB key).
t * (t >> 8 | t >> 11)
a = 3, b = 6; t >> a | t >> b
f = (n) => {n*t}; f(1)
t t 8 >> t 11 >> | *
3 a = 6 b = t a >> t b >> |
(n) { n t * } f = 1 f
| Operator | Description |
|---|---|
+ - * / % | Basic arithmetic operations |
>> << | Bitwise shifting |
& | ^ | AND, OR and XOR Bitwise operations |
? : | Ternary conditions: (cond) ? true : false |
< > <= >= == != | Comparison operators |
= | Assign value of function to variable |
| Operator | Description |
|---|---|
sin cos tan sqrt log exp min max pow cbrt ... | Math library functions |
=> map filter sum reduce | Functional programming support |
... and others | Opionated JS-like floatbeat support |
Bytebeat aims to support around 80% of the commonly used Javascript syntax, with some opionated exceptions. Users are encouraged to use map and reduce by not implementing while and for loops. Only arrow functions and ternary clauses are supported. Arrays are cyclic by design and characters return base62 values directly (0-Z).
Bytebeat bytecode virtual machine support running complex bytebeat & floatbeat functions live with the ESP32 chips. Bytebed is targeted for M5Stack cardputers (at least for now) for easy & fun experience. Supports "screencasting" to desktop and mobile phones using captive portal and syncing with multiple cardputers using WIFI / ESP-NOW.
Compile the source and flash to cardputer using platform.io
If you are eager to try, you can also run the compiler & virtual machine in the browser.