Skip to content
Implementation of @vkazanov's "World's Simpest" bytecode interpreters... in Rust.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
01_simplest
02_arguments
03_stack
04_registers
05_thompson
.gitignore
LICENSE
README.md

README.md

Language: Rust Topic: Academic Topic: Interpreters Status: In Progress

Primitive Bytecode Interpreters

The five branches here represent Vladimir Kazanov's first five World's Simplest Bytecode Interpreters, starting with one that has exactly two instruction and ending with one that does something useful, in this case recognize Kleene regular expressions without closure (that is, without the * operator). Kazanov's versions are in C and have all the advantages and disadvantages of C; these are in Rust, and the tradeoffs between efficiency and safety are described in a series of blog posts:

The biggest lesson is that Rust's literalness with its enum uses more memory and takes longer to load a program off-disk, but is much easier to reason about and modify. Rust's memory management makes some things impossible, but doesn't constrain you from walking off the edge of the world in a program spine, a data sample, or a stack; on the other hand, while you can represent a syntactically invalid bytecode program in C, it's impossible to do the same thing in Rust.

License

GPLv3. Consult the LICENCE file for details.

You can’t perform that action at this time.