A Universal Source-to-Source Compiler: Write Once, Compile to 30+ Languages
Overview • Features • Tech Stack • Architecture • Quick Start • Contact
Babele is a universal source-to-source compiler designed to bridge the gap between modern software development and legacy systems. Millions of lines of COBOL, Fortran, and Ada run in production in banks, airlines, and governments, yet the developers who wrote them are retiring, and rewriting them by hand costs millions.
Babele solves this. You write modern code once, and Babele automatically generates idiomatic, readable, and maintainable legacy code. While most compilers support only 2-3 backends, Babele targets over 30 languages, spanning 72 years of computer science history—from 1949 to 2021. It is not just a compiler; it is a bridge between worlds that never spoke to each other.
- Universal Compilation: Write in a single
.babefile and compile it to multiple completely different ecosystems. - 6 Working Backends: Production-ready code generation for C, Python, JavaScript, Rust, Swift, and COBOL.
- Extensive Language Support: Supports variables (
let), arithmetic, comparison, booleans, strings, integers,print(...),if / else, andwhileloops. - 30+ Planned Backends: A massive roadmap covering Systems (C++, Zig, Assembly), Legacy Enterprise (Fortran, Ada, Forth), Functional (Haskell, OCaml, Erlang), Formal Research (Lean 4, Coq, Agda), and Historical (Smalltalk, Algol 68, APL) languages.
- Clean Architecture: A robust Lexer and Parser written in Rust generates an Abstract Syntax Tree (AST) before passing it to independent code generators.
- Rust: The primary language used for the Lexer, Parser, and AST generation, ensuring memory safety and lightning-fast execution.
- Modular architecture where each target language (C, COBOL, Python, JS, Rust, Swift) has its own independent generator.
source.babe
|
v
Lexer / Parser (Rust) -> AST
|
v
Code Generators -> C, COBOL, Python, JS, Rust, Swift, ...
(per-target)
- Rust and Cargo installed on your system.
-
Clone the repository:
git clone https://github.com/nowii-core/babele.git cd babele -
Build the compiler:
cargo build --release
-
Compile to any target:
./target/release/babele examples/hello.babe --target=c ./target/release/babele examples/hello.babe --target=cobol ./target/release/babele examples/hello.babe --target=python ./target/release/babele examples/hello.babe --target=js ./target/release/babele examples/hello.babe --target=rust ./target/release/babele examples/hello.babe --target=swift
Every backend is independent. If you are an expert in COBOL, Fortran, Ada, or Forth, or if you want to help build the future of source-to-source compilation, there is a place for you.
Open an Issue to discuss which backend or feature you would like to work on.
This project is distributed under the MIT license. See the LICENSE file for more information.
- Maintainer: @nowii-core
- Bug Reports & Feature Requests: If you encounter an issue or would like to suggest an improvement, open an Issue or submit a Pull Request.
