$ show fusionlanguage/fut
Fusion Transpiler (fut) is a self-hosting, multi-target transpiler that translates code written in the Fusion language into C, C++, C#, D, Java, JavaScript, Python, Swift, TypeScript, and OpenCL C. The repository contains the complete compiler implementation written in Fusion itself, including a lexer, parser, semantic analyzer, and a family of code generators organized via a visitor pattern. It also includes a comprehensive test suite, command-line interfaces for multiple host languages (C++, C#, Java, Node.js), editor integrations (VS Code, Vim, Sublime, Visual Studio, LSP server), and packaging for Debian, Windows, and RPM. The architecture follows a classic compiler pipeline with a clear separation of concerns, and the self-hosting bootstrap ensures the compiler is exercised on its own code. This is a pure application project with no data processing or research components; it is a production-quality compiler toolchain.
The LLM identified 2 files worth highlighting for reuse:
Implements integer range arithmetic with saturated operations, used for constant folding and type inference. The code is self-contained, well-structured, and demonstrates non-obvious skill in handling overflow and bounds. It could be extracted as a standalone library for safe integer computations in other compilers or static analysis tools.
Base class for all code generators providing indentation management, literal writing, type annotation dispatch, and temporary variable handling. The visitor pattern and temporary management are reusable patterns for any code generator that needs to emit formatted output with side-effect expression ordering.