Crate yksom[][src]

A SOM VM in Rust. SOM is a cut-down Smalltalk-like language. yksom is eventually intended to be used with Yorick to produce a JIT-compiling VM, though it is currently an entirely stand-alone interpreter. Currently it is partly a test bed to experiment with good ways of structuring Rust interpreters, balancing correctness, performance, and readability.

yksom is split into a compiler and run-time. The compiler parses SOM programs and creates the run-time structures that the run-time can then execute. As this suggests, the compiler can operate at run-time, so there is a fairly tight inter-weaving between the compiler and run-time.

Modules

compiler

A SOM compiler. This is currently fairly simplistic, particularly in terms of code generation (though it does at least use lrpar, so one gets decent error messages). The interchange format between the compiler and the VM currently uses a Rust enum and is probably fairly inefficient.

vm

The yksom run-time. The run-time uses trait objects but stores them as thin pointers (using the experimental natrob library. This allows integer tagging to be used. The Val struct stores tagged integers / pointers to boxed objects. The Obj trait is the “supertype” trait of all objects, but it is not intended that most parts of the VM call Obj directly: one should use the identically named methods on Val. As this suggests, users should, in most cases, either operate directly on a Val or Val::downcast (or Val::try_downcast) it to a concrete implementation of Obj.