Skip to main content

Add your description here

Project description

QBEWA - WebAssembly to QBE Compiler

QBEWA is an ahead-of-time (AOT) compiler that translates WebAssembly binary modules into native machine code using QBE as the backend.

Features

  • WASM Binary Parsing: Parse WebAssembly binary modules
  • Stack-to-SSA Translation: Convert WebAssembly's stack-based model to QBE's SSA form
  • Control Flow Conversion: Transform structured control flow (blocks, loops, ifs) to basic blocks and jumps
  • Type Mapping: Map WASM types (i32, i64, f32, f64) to QBE types (w, l, s, d)
  • QBE Backend: Generate QBE intermediate language code

Installation

# Clone the repository
git clone https://github.com/yourusername/qbewa.git
cd qbewa

# Install dependencies using uv
uv sync

Usage

Basic Compilation

# Compile a WASM file to QBE IL
qbewa input.wasm -o output.qbe

# Run tests
make test

# Run specific test types
uv run pytest -m unit              # Unit tests only
uv run pytest -m integration       # Integration tests only
uv run pytest -m e2e               # End-to-end tests only

Development Commands

# Format code
make format

# Lint and type check
make lint

# Run with coverage
make test-cov

# Multi-version testing via nox
nox -s tests              # Run tests on all Python versions
nox -s check              # Run linting/type checking

Project Structure

qbewa/
├── src/
│   └── waq/              # Main source code
│       ├── compiler/     # Compilation logic
│       ├── parser/       # WASM binary parsing
│       ├── runtime/      # Runtime support
│       └── cli.py        # Command-line interface
├── tests/                # Test suite
│   ├── a_unit/           # Unit tests
│   ├── b_integration/    # Integration tests
│   └── c_e2e/            # End-to-end tests
├── local-notes/          # Project documentation
└── runtime/              # Runtime components

Documentation

Comprehensive documentation is available in the local-notes/ directory:

  • Project Documentation: Vision, specifications, design decisions
  • Python Development Guidelines: Coding standards, testing strategies, design patterns
  • WASM-to-QBE Transformation: Detailed compiler specifications

Testing

The project follows a pyramid testing structure:

  • Unit Tests: Fast, isolated tests in tests/a_unit/
  • Integration Tests: Component interaction tests in tests/b_integration/
  • End-to-end Tests: Full workflow tests in tests/c_e2e/

Code Style

  • Targets Python 3.12+
  • Uses Ruff with ALL rules enabled
  • Multiple type checkers: ty, pyrefly, mypy
  • All files must have from __future__ import annotations

License

[Specify your license here - e.g., MIT, Apache 2.0, etc.]

Contributing

See CONTRIBUTING.md for contribution guidelines.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

waq-0.1.0-py3-none-any.whl (41.1 kB view details)

Uploaded Python 3

File details

Details for the file waq-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: waq-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 41.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for waq-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e472ede719dfe3c2d83f4faf0895b45ad00ebeacec0db6bcde34041c7f198622
MD5 5668c0271eeec65d4df7d1352edcad2b
BLAKE2b-256 10d0862e34dbcd4e9e7bf325ecd2ccce2f0c19ea4ab78b9c788a95292026480d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page