Compiler Compiler System Translation Pipeline: From Python to TypeScript with Full RealWorld Conformance

Translating an existing application from one general-purpose programming language into another is a long-standing engineering problem with no general solution. Arbitrary source-to-source translation is intractable because the two languages live in different runtime-semantic worlds with significant non-isomorphism in their type systems, exception models, standard libraries, and reflection capabilities. We report a worked example in which a specific class of application — a data-model-shaped web backend, specifically the canonical RealWorld / Conduit Medium-clone specification implemented in Python with FastAPI — is mechanically translated into TypeScript via a multi-stage pipeline of deterministic transformations operating over a small, well-bounded family of domain-specific languages. The pipeline decomposes the Python source into ten family-specific DSLs (DataModelEntity, DataModelRelationship, RouteContract, RouteHandler, RepositoryQuery, AuthPolicy, ValidationRule, ErrorHandling, Configuration, ApplicationBootstrap), emits TypeScript fragments through ten independent per-family emitters, assembles the fragments into target modules, fills handler bodies through a registry of hand-authored translations, and wires the result through a thin TypeScript runtime adapter into an Express HTTP service. The resulting service passes 293 of 293 assertions of the canonical RealWorld Postman conformance collection — exceeding the upstream Python baseline of 280 assertions. The methodological discipline that drove the work — Adaptive Programming: explicit `LOCK` invariants declared at every slice opening, hand-authored golden artefacts validated by byte-equal diff before any implementation iteration — closed forty-six slices over the arc, of which forty-two landed without implementation iteration. We are explicit about scope: the authentication flow is end-to-end pipelined (register, login, JWT issuance, validation cross-call), exercising the full decompose → emit → assemble → bodies → runtime path; the non-authentication endpoints (articles, comments, profiles, tags, follow) execute against hand-wired runtime handlers that share state with the pipelined infrastructure. The full Postman collection passes against the resulting service.

Authors

Institutions

Publication Details

Journal
Zenodo (CERN European Organization for Nuclear Research)
Published
2026-09-06
DOI
https://doi.org/10.5281/zenodo.22548018
Primary Topic
Logic, programming, and type systems
Type
preprint
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
preprint

Compiler Compiler System Translation Pipeline: From Python to TypeScript with Full RealWorld Conformance

Aleksandr F. Urakhchin
Zenodo (CERN European Organization for Nuclear Research)
Logic, programming, and type systems
preprint

Compiler Compiler System Translation Pipeline: From Python to TypeScript with Full RealWorld Conformance

Aleksandr F. Urakhchin
preprint en

Abstract

Translating an existing application from one general-purpose programming language into another is a long-standing engineering problem with no general solution. Arbitrary source-to-source translation is intractable because the two languages live in different runtime-semantic worlds with significant non-isomorphism in their type systems, exception models, standard libraries, and reflection capabilities. We report a worked example in which a specific class of application — a data-model-shaped web backend, specifically the canonical RealWorld / Conduit Medium-clone specification implemented in Python with FastAPI — is mechanically translated into TypeScript via a multi-stage pipeline of deterministic transformations operating over a small, well-bounded family of domain-specific languages. The pipeline decomposes the Python source into ten family-specific DSLs (DataModelEntity, DataModelRelationship, RouteContract, RouteHandler, RepositoryQuery, AuthPolicy, ValidationRule, ErrorHandling, Configuration, ApplicationBootstrap), emits TypeScript fragments through ten independent per-family emitters, assembles the fragments into target modules, fills handler bodies through a registry of hand-authored translations, and wires the result through a thin TypeScript runtime adapter into an Express HTTP service. The resulting service passes 293 of 293 assertions of the canonical RealWorld Postman conformance collection — exceeding the upstream Python baseline of 280 assertions. The methodological discipline that drove the work — Adaptive Programming: explicit `LOCK` invariants declared at every slice opening, hand-authored golden artefacts validated by byte-equal diff before any implementation iteration — closed forty-six slices over the arc, of which forty-two landed without implementation iteration. We are explicit about scope: the authentication flow is end-to-end pipelined (register, login, JWT issuance, validation cross-call), exercising the full decompose → emit → assemble → bodies → runtime path; the non-authentication endpoints (articles, comments, profiles, tags, follow) execute against hand-wired runtime handlers that share state with the pipelined infrastructure. The full Postman collection passes against the resulting service.

Zenodo (CERN European Organization for Nuclear Research)
China Three Gorges Corporation (China) (CN)
Industry, innovation and infrastructure
Logic, programming, and type systems
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.