xpile 0.1.1

Polyglot transpile workbench (Python/C/C++/Rust/Ruchy/Lean ↔ Rust/Ruchy/PTX/WGSL/SPIR-V) with provable contracts at every layer.
1
2
3
4
5
6
7
8
9
10
11
12
13
# `assert` statement fixture (PMAT-009).
#
# Exercises:
#   - `assert cond` (no message form) inside a function body
#   - cond reads function params, validating the assert lowering doesn't
#     break access to bindings
#
# The Rust emission becomes `assert!(...)`, which panics at runtime on
# false. Driver passes only inputs that satisfy the precondition.
def safe_div(a: int, b: int) -> int:
    assert b != 0
    assert a >= 0
    return a // b