Developer speeds up Russian-syntax language 130x by transpiling to Python AST
A developer building SkyForge, a Russian-syntax programming language, found their original tree-walking interpreter written in Python was 30–100 times slower than CPython, with a Fibonacci(32) computation taking 60 seconds instead of 0.4. To fix this without a full rewrite, they chose to transpile SkyForge's AST directly into Python's native AST using the standard library's ast module, then pass it to compile() to generate CPython bytecode. The resulting transpiler is around 600 lines of Python with no external dependencies, and converts source code to bytecode in just three function calls. Key challenges included correctly handling line numbers required by Python 3.12 and distinguishing between arithmetic operators and comparison operators in the AST. The project is open source, with the transpiler code available on GitHub for others building similar language tools.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in