multilingual is a programming language with one formal semantic core and multiple natural-language frontends. Write in English, French, Spanish, Japanese, Arabic, Hindi and more — compile to Python or WASM.
Write the same logic in any supported language. The compiler maps it all to the same formal core and Python output.
let name = "world"
let count = 5
def greet(n):
for i in range(count):
print(f"Hello, {n}! iteration {i}")
greet(name)Why multilingual?
English, French, Spanish, German, Italian, Portuguese, Polish, Dutch, Swedish, Danish, Finnish, Hindi, Arabic, Bengali, Tamil, Chinese, and Japanese — all as first-class frontends.
All language frontends compile to the same Core AST and CoreIRProgram. Semantics are identical regardless of the surface language used.
Optional WebAssembly backend delivers 50–100x speedups for matrix operations, cryptography, scientific computing, and more — with automatic Python fallback.
Full Python 3.12+ syntax subset: classes, async/await, comprehensions, decorators, f-strings, pattern matching, generators, context managers, and more.
Add a new programming language primarily through JSON configuration files — no parser rewrites needed. Keyword mappings, builtins, and surface patterns all via data.
Comprehensive test coverage across all 17 languages. Every language frontend is validated end-to-end: lexer → parser → semantic → codegen → execution.
Language-switching REPL with Python preview mode. Switch between all 17 languages mid-session. Inspect generated Python, list keywords and operators.
SOV and RTL languages (Japanese, Arabic, Hindi, Bengali, Tamil) support natural word order through declarative surface normalization rules.
Support for Unicode numerals, Roman numerals, complex numbers, fractions, and scientific notation across scripts. Use the numeral system of your language.
Supported Languages
Each language is a full first-class frontend with localized keywords, error messages, builtins, and REPL support.
Quick Start
Install:
1
2
3
4
5
6
7
8
# Minimal (Python backend only)
pip install multilingualprogramming
# Recommended (Python + WASM acceleration)
pip install multilingualprogramming[wasm]
# Maximum performance (Python + WASM + NumPy)
pip install multilingualprogramming[performance]
Start the REPL:
1
2
3
4
5
6
7
8
9
10
11
# Default (English)
python -m multilingualprogramming repl
# French
python -m multilingualprogramming repl --lang fr
# Japanese
python -m multilingualprogramming repl --lang ja
# With Python preview
python -m multilingualprogramming repl --show-python
Run a file:
1
2
python -m multilingualprogramming run myprogram.ml --lang en
python -m multilingualprogramming run programme.ml --lang fr
Use as a library:
1
2
3
4
5
6
7
8
from multilingualprogramming import ProgramExecutor
executor = ProgramExecutor()
executor.execute("""
let x = 10
let y = 20
print(x + y)
""", language="en")
Architecture
Every program, in any language, follows the same forward-only pipeline to Python or WASM output.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
Surface Language (.ml file)
│
▼
┌─────────────┐
│ Lexer │ Unicode-aware tokenization, keyword concept resolution
└──────┬──────┘
│ Concept tokens (COND_IF, LOOP_FOR, FUNC_DEF...)
▼
┌─────────────────┐
│ Surface Normal. │ Optional: rewrite SOV/RTL word order to canonical
└──────┬──────────┘
│
▼
┌─────────────┐
│ Parser │ Build language-agnostic Core AST
└──────┬──────┘
│
▼
┌─────────────────┐
│ Core IR Wrap │ CoreIRProgram (typed container with metadata)
└──────┬──────────┘
│
▼
┌──────────────────┐
│ SemanticAnalyzer │ Scope, symbol, structural checks
└──────┬───────────┘
│
┌────┴────┐
│ │
▼ ▼
┌───────┐ ┌──────┐
│Python │ │ WASM │ Code generation targets
│ Gen │ │ Gen │
└───┬───┘ └──┬───┘
│ │
▼ ▼
┌───────┐ ┌──────────┐
│Python │ │ Cranelift│
│Runtime│ │ Compiler │
└───────┘ └──────────┘