mizu

Mizu is a lightweight easily extensible interpreter loosely modeled off of RISC-V assembly.

https://github.com/doir-lang/mizu

Science Score: 57.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 2 DOI reference(s) in README
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (10.7%) to scientific vocabulary
Last synced: 6 months ago · JSON representation ·

Repository

Mizu is a lightweight easily extensible interpreter loosely modeled off of RISC-V assembly.

Basic Info
Statistics
  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • Open Issues: 3
  • Releases: 1
Created over 1 year ago · Last pushed 9 months ago
Metadata Files
Readme License Citation

README.md

Mizu's Mascot

Mizu

Unlicensed DOI

Mizu is a lightweight, easily extensible interpreter loosely modeled after RISC-V assembly.

Programs are represented as an array of opcodes, which are then allowed to manipulate virtual registers and a virtual stack. The simplest "useful" Mizu program is:

```cpp

define MIZU_IMPLEMENTATION

include

const static mizu::opcode program[] = { mizu::opcode{mizu::loadimmediate, mizu::registers::t(0)}.setimmediate(40), mizu::opcode{mizu::debug_print, 0, mizu::registers::t(0)}, mizu::opcode{mizu::halt}, };

int main() { mizu::registersandstack environment = {}; setup_environment(environment);

MIZU_START_FROM_ENVIRONMENT(program, environment);

} ```

Take a read through the documentorial (documentation and tutorial rolled into one) to learn about the details of Mizu programs and our instructions.

Features

  • Small (our test executables are less than 50kb)
  • Portable (should run anywhere with a C++ compiler[^1], even microcontrollers and the web)
  • Fast (recursively calculates the 40th Fibonacci a full second faster than Lua)
  • Header-only[^2]/Easily embeddable as a library!
  • Simple and easily extensible instructions
  • Integer and float support
  • Built-in threading instructions (also includes simple go-like channels for inter-thread communication)
  • Fallback coroutine "threading" for single-core machines
  • Built in FFI instructions (Mizu can call external functions in the same way it calls its own, just substitute the jump_to instruction for ffi::call)
  • Portable Binary Format and a runner for it.

[^1] Our architecture requires tail call optimization; compilers that don't support that (avr-gcc, MSVC) will compile but can only run the simplest of programs!

[^2] FFI support relies on libffi which is not header-only!

Tail Call Warning

Mizu makes heavy use of tail call optimization; if this optimization is not present, programs will likely crash. At the moment, only clang has been configured to support tail call operations in debug mode. Visual Studio will likely fail! Testing has shown that Microsoft's Visual Studio compiler doesn't tail-call optimize; thus, on Windows, using Msys or MinGW is necessary.

How to Integrate

The easiest way to integrate Mizu is to add it as a subdirectory using CMake:

cmake add_subdirectory(path/to/mizu) ... target_link_libraries(your_cmake_target PUBLIC mizu::vm)

Then include mizu/instructions.hpp and define MIZU_IMPLEMENTATION in one of your source files.

Hard Way

You can also make sure ./ and ./thirdparty/libfp are marked as include directories. Then if you are going to use FFI make sure libffi also gets built, linked, and included.

Owner

  • Name: doir-lang
  • Login: doir-lang
  • Kind: organization

Citation (CITATION.cff)

cff-version: 1.2.0
authors:
- family-names: Joshua Dahl
date-released: '2025-06-02'
doi: 10.5281/zenodo.15578022
identifiers:
- type: swh
  value: swh:1:dir:55ffb3395cce18ae2978962f4edd877472ce9e6b;origin=https://doi.org/10.5281/zenodo.15578021;visit=swh:1:snp:8e6972bc08d95088d629853ddb28a9495b04b64d;anchor=swh:1:rel:83bc0026eead25c38e64295cb21bd039b84d20b1;path=joshuadahlunr-MizuVM-171356f
license:
- mit
message: If you use this software, please cite it using the metadata from this file.
repository-code: https://github.com/joshuadahlunr/MizuVM/tree/paper
title: 'joshuadahlunr/MizuVM: Paper1'
type: software
version: paper

GitHub Events

Total
Last Year

Dependencies

.github/workflows/build-docs.yaml actions
  • actions/checkout v4 composite
  • actions/setup-python v5 composite
  • ad-m/github-push-action master composite
docs/requirements.txt pypi
  • breathe *
  • sphinx *
  • sphinx-bootstrap-theme *