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
# PMAT-458 / v0.2.0 Track 1.B: for-each iteration over list[int].
# Exercises Stmt::ForEach + a mutable accumulator + C-PY-INT-ARITH's
# checked-add discharge inside the loop body. Closes the spec §23
# ⏳ entry "`for` over non-range iterables".
def total(xs: list[int]) -> int:
    s = 0
    for x in xs:
        s = s + x
    return s