Module mice::mir

source · []
Expand description

An IR language to lower dice programs to, with the goal of permitting more complex dice operators.

Design goals include:

  • Providing a good backend for end-user custom logic
  • Supporting a slow runtime mode that keeps many intermediate results for the purpose of end-user visible textual output
  • Supporting a fast runtime mode for statistical sampling and analysis

These are both currently implemented in the interp and stack modules, and supporting these use cases is a requirement for a shift to this IR.

And we have possible stretch goals of:

  • Supporting a possibly slower runtime mode that keeps all intermediate results for the purpose of end-user visible 3D dice roll animations (this one’s outside of my use case, but this IR shouldn’t stand in the way of doing that)
  • Supporting a JIT compiled runtime mode for faster statistical sampling and analysis
  • Supporting a GPU based backend for even faster statistical sampling and analysis

Modules

MIR based intermediate result formatting.

Optimizations on the MIR. Not much going on here, for now.

A stack based virtual machine for dice expressions, as a backend for MIR. Should be fast enough and flexible enough to support both end-user textual output, and statistical sampling and analysis.

Structs

A dice program lowered to a graph structure based on RVSDG.

Enums

Error type for constructing MIR programs. The specific role that this will play is not yet clear, as our story for constructing MIR is still quite immature.

Functions

Generate GraphViz DOT code for a MIR graph.

Lower a parsed dice program to MIR. Currently infallible, as the parser already rejects ill-typed programs.