Skip to content

typeobject/wheeler

Repository files navigation

Wheeler Virtual Machine (WVM)

A reversible, concurrent virtual machine and programming language.

This project is just an experiment and is still in the early stages of development. You should probably come back later once I'm sure it'll work at all.

Overview

The Wheeler Virtual Machine provides a platform for writing and executing perfectly reversible programs, including support for concurrent execution. Every operation can be reversed, enabling exact reconstruction of previous program states.

Key features:

  • Perfect reversibility of all operations.
  • Concurrent execution with reversible synchronization.
  • Quantum-inspired instruction set.
  • Modern Java implementation.
  • Comprehensive testing framework.

Requirements

  • Java 22 or higher
  • Gradle 8.5 or higher

Quick Start

Build the project:

./gradlew build

Compile a Wheeler program:

./gradlew wheelc -Psource=examples/HelloWorld.w

Run a Wheeler program:

./gradlew wheel -Pfile=HelloWorld.wc

Project Structure

  • wheeler-core: Core virtual machine implementation
  • wheeler-compiler: Wheeler language compiler
  • wheeler-runtime: Runtime libraries and support
  • wheeler-tools: Development and debugging tools
  • wheeler-examples: Example programs and tests

Documentation

Example

// Basic counter example demonstrating reversibility
classical class Counter {
    rev int count = 0;

    rev void increment() {
        count++;
    }

    rev void decrement() {
        count--;
    }

    pure int get() {
        return count;
    }

    rev static void main(String[] args) {
        Counter c = new Counter();

        // Forward execution
        c.increment();
        c.increment();
        System.out.println(c.get()); // 2

        // Reverse execution 
        reverse {
            c.increment();
            c.increment();
        }
        System.out.println(c.get()); // 0
    }
}

For additional examples, see wheeler-examples.

Contributing

See CONTRIBUTING.md for guidelines on how to contribute to the project.

License

Wheeler is licensed under the Apache License 2.0 - see LICENSE for details.

Acknowledgments

Inspired by:

  • John Wheeler's "It from Bit" concept.
  • Bennett's work on reversible computation.
  • The Java Virtual Machine.

Status

Wheeler is currently in early development. The API and bytecode format are subject to change.

Getting Help

Citation

If you use Wheeler in your research, please cite:

@software{wheeler_vm_2024,
  title = {Wheeler Virtual Machine},
  author = {TypeObject},
  year = {2024},
  url = {https://github.com/typeobject/wheeler}
}