txtvm

txtvm

A potential idea for an toy VM with a plain text bytecode system.

Inspired by a half baked idea:

2020-07-28 12:24:00: the idea would be to build and share tiny 6.5 bit programs encoded as printable ascii characters. this could then in turn be read by a virtual computer to do things like paint a picture or compose a piece of music. #halfbakedideas

How does one share digital art in a low bandwidth kind of way? txtvm tries to answer this a fun hacker way.

Instead of trying to use fancy compression algorithms, express the work as a program small enough to fit inside of a toot, tweet, or twtxt post.

The program can be downloaded and read by a specialized interpreter. The interpreter holds all the complexity and is able then render the results.

So, a big part of this system is coming up with a serialiazation format. Because it is limited to printable ascii, it would be a 6-bit serialization format. Perhaps loosely based on msgpack and bare.

The language itself would be a simple stack-based VM, with words being represented as integer values to save space. Programs in txtvm themselves would probably be meta-programmed using high-level languages like janet or scheme.

A VM like this would place heavy emphasis on custom bytecode interpreters, treating the bytecode as more of a low-level domain specific language. One interpreter could be something geared for controlling a synthesizer. Another could be made for drawing pictures. Each interpreter would have their own dictionary of low-level primitives to choose from, and the bytecode would be designed to run on the agreed upon system.


home | index