Repository navigation
TyPy 0.1.0
The first release. TyPy 0.1 compiles programs made of module-level
functions and statements over int, float, str, bool and None to
native executables for x86_64 Linux, with glibc or statically with musl.
Each program it accepts prints what CPython 3.12 to 3.15 prints. The
compiler needs glibc 2.39 or later and a C toolchain.
Added
- Engineering documents: research, requirements specification, use case
and domain models, architecture, decision records ADR-0001 to ADR-0008,
detailed design for 0.1, test plan and development guide. - A development container with Rust 1.99.1, LLVM 23, musl, CPython 3.12 to
3.15 for conformance testing, and the documentation tools. - The
typy-diagnosticscrate: source spans, diagnostic codes, the code
registry and text rendering, with unit and property tests. - The
typy-sourcecrate: reading source files with the 16 MiB and UTF-8
checks, line and column positions, parsing with the program's Python
floor, and TyPy's own syntax tree with its text dump. - The
typy-checkcrate: the 0.1 feature table, name resolution with
Python's scoping, type inference within a function, definite assignment,
and the typing rules for the operators and builtins of 0.1. Every
rejection names its rule. - The
typy-tyircrate: TyIR's types, a function builder, a verifier that
checks definitions by dominance and the types of every operation, and the
text form for--emit=tyir. - The
typy-lowercrate: lowers a checked program to TyIR with reference
counting, error returns throughinvoke, and the semantics of CPython for
loops,and,or, comparison chains and the builtins of 0.1. - The
typy-codegencrate: turns TyIR into LLVM 23 IR, assembly and object
code, with static immortal constants and traceback entries on raising
calls;--release-smallmarks functionsminsize, as LLVM 23 has noOz. - The
typy-runtimecrate, without the standard library: object headers,
reference counting,strobjects and their operations, exceptions with
tracebacks and the uncaught-exception report, buffered output, the stack
check andmain.make runtimebuilds the archive programs link. - Unlimited-size
intin the runtime: arithmetic,//,%and**with
Python's floor rules, bitwise operators and shifts, comparisons, and
conversion to and fromstrwithint()'s parsing rules and CPython's
4300-digit limit. Error messages match CPython's. floatin the runtime:/,//,%,**andabswith CPython's
special cases;int / int,float(int)andfloat(str)rounded once to
the nearest double; exactint(float)and exact comparison ofintwith
float; andreprwith CPython's shortest digits and layout.- Every division by zero raises
ZeroDivisionError: division by zero, the
wording of CPython 3.14 and later (OI-14). reprof a string escapes exactly the code points CPython 3.15 escapes,
from Unicode 17.0 tables generated from CPython's own data (OI-15).chrandordin the runtime, with CPython's messages.int()andfloat()read decimal digits of every script, such as
int("\u0661\u0662"), which is12.- The
typy-buildcrate: build requests, modes and--emitstages, and
the link of an object file with the runtime archive throughccor
musl-gcc. The executable appears whole or not at all; a missing
toolchain program is E0701, a failed link E0702, and a missing runtime
archive, or one from another TyPy version, E0703. - Diagnostics without a source location, such as a failed link.
- The
typycommand:typy check FILE,typy build FILEwith--emit,
-o,--releaseand--release-small, andtypy run FILE -- ARGS,
which keeps each build in a cache underTYPY_HOMEand runs it again
without compiling. Exit status 0 on success, 1 for program errors, 2 for
wrong usage and 101 for an internal error, which a panic also becomes. - The
typy-conformancecrate and a conformance suite of 89 programs in
tests/conformance/: each accepted program runs under CPython 3.12 to
3.15 and under TyPy in debug and release mode, with the same output,
exit status and last line of standard error; each rejected program gets
exactly its diagnostic code at its line and column.make testruns it. - Every accepted conformance program also runs linked with AddressSanitizer
and LeakSanitizer and must show no report. A program that ends with an
uncaught exception frees the exception before it exits, so it leaks
nothing. - The sanitizer run uses a runtime built with AddressSanitizer, so every
memory access the runtime makes is checked.make miriruns the
runtime's unit tests under Miri, andmake fuzzfuzzes the source,
checking and lowering stages. - Continuous integration: the quality gate and the release archive on
every pull request, Miri and 30 minutes of fuzzing on demand before a
release, code scanning, dependency review, and monthly grouped Dependabot
updates. A tagvX.Y.Zreleases the
version after a maintainer approves it. make distbuilds a reproducible release archive of the compiler and its
runtime archives, and runs a program with it unpacked.make checkmeasures branch coverage as well as line coverage and fails
below 95 percent of either (NFR-11);make coverage-branchesruns that
measurement alone, andmake test-int,make test-e2eand
make test-allrun one test level each.- Golden tests of every text stage of
--emitand of rendered
diagnostics intests/golden/;make blessrewrites them. - End-to-end tests for a missing or failing C toolchain, an empty program,
the 16 MiB limit, a file that is not UTF-8, two builds at once, argument
forwarding bytypy run, and environment variables that must not change
the output. - The stack check reads the stack pointer register, so
RecursionError
is raised in time also when locals do not live on the machine stack. - The runtime archive is built for musl as well as glibc, and
make check
checks its size: 40.3 KB, and 29.8 KB without large integers (NFR-02). A
hello world built with--release-smalland linked statically with musl
is 75 KB (NFR-01). - E0106 when an output file cannot be written; the linker reports a
directory it cannot write with E0106 instead of E0702. - The
typy-drivercrate: runs loading, checking, lowering, code
generation and linking in order, and stops after the stage--emit
names.--emit=typed-astwrites every node with its position and type,
and--emit=tyirleaves out theincanddecthat--emit=tyir-mem
shows. - A quality gate,
make check, that checks formatting, runs Clippy and the
tests with at least 95 percent line coverage, lints the documents, checks for
non-ASCII text, checks that every requirement has a row in the test plan,
and checks that every diagram is rendered from its source.