English | ุงูุนุฑุจูุฉ | Franรงais | Espaรฑol | Deutsch | ไธญๆ | ๆฅๆฌ่ช
A multilingual programming language that lets you write, run, detect, and translate code in your native language.
Resources & Links:
-
- ๐ Getting Started
- ๐ Language Reference
- ๐ Supported Languages
- ๐ค Contributing Guide
-
๐ Official Website
-
๐ฌ Join the Community
WorldLang is an open-source interpreter built in Python that removes the language barrier in programming. Instead of requiring programmers to write using English keywords, WorldLang allows code to be written using native-language syntax.
The interpreter supports a multilingual execution pipeline built around a custom Lexer โ Parser โ Runtime architecture, along with automatic language detection and integrated source-to-source code translation.
Supported languages: 31 โ Arabic, Azerbaijani, Chinese, Dutch, English, Finnish, French, German, Greek, Indonesian, Irish, Italian, Japanese, Kazakh, Korean, Kurdish, Latvian, Malay, Persian, Polish, Portuguese, Romanian, Russian, Spanish, Swedish, Turkish, Ukrainian, Urdu, Uzbek, Vietnamese, and Hindi.
- Features
- Requirements
- Installation
- Usage
- Language Detection & Selection
- Code Translation
- Code Example
- Built-in Libraries
- Architecture
- Language & Library Management
- Contributing
- License
- Native-language programming โ write code using the keywords of your chosen language.
- 31 supported language packs with dynamically loaded keyword mappings.
- Hybrid language selection โ manually select a language or allow WorldLang to detect it automatically.
- AI-based language detection โ automatically detect the programming language syntax before lexing when no language is manually selected.
- Cross-language execution โ run files written in different supported languages without manually switching the global language.
- Integrated code translation โ translate WorldLang source files between supported languages.
- Dynamic keyword mapping โ the lexer maps native keywords to generic tokens on the fly.
- Full-featured interpreter โ variables, functions, recursion, loops, conditionals, lists, dictionaries, and arithmetic.
- Hardware & robotics โ serial communication for microcontrollers such as Arduino.
- Speech โ text-to-speech and voice recognition.
- Built-in libraries โ image processing, plotting, random utilities, filesystem tools, and more.
- Generative AI โ optional Google Gemini integration.
- Library & extension management โ fetch
.worldlibraries and extensions directly from the network.
- Python 3.12+
- Windows, macOS, or Linux
Core packages:
| Package | Used for |
|---|---|
requests |
Downloading language packs, libraries, and extensions |
numpy |
AI language detection and numerical processing |
keras |
AI-based language detection |
nltk |
Language detection preprocessing |
Pillow |
Image processing (_builtins/Image.py) |
matplotlib |
Plotting (_builtins/Graph.py) |
pyautogui |
Mouse/keyboard control (_builtins/Controls.py) |
pyserial |
Serial/hardware communication (_builtins/Serial.py) |
pyttsx3 |
Text-to-speech (_builtins/Speech.py) |
SpeechRecognition |
Voice recognition (_builtins/Speech.py) |
google-generativeai |
Generative AI (_builtins/GenAI.py) |
rich |
Markdown rendering for AI output (_builtins/GenAI.py) |
Only
requestsis required for the basic interpreter.Keras,NLTK, andNumPyare required for AI-based automatic language detection. Other packages are required only for their corresponding optional built-in libraries.
# 1. Clone the repository
git clone https://github.com/ZiadRabea/WorldLang.git
cd WorldLang
# 2. (Recommended) Create and activate a virtual environment
python -m venv venv
# Windows:
venv\Scripts\activate
# macOS / Linux:
source venv/bin/activate
# 3. Install dependencies
pip install requests numpy keras nltk Pillow matplotlib pyautogui pyserial pyttsx3 SpeechRecognition richTo enable Google Gemini AI features:
pip install google-generativeaiThe interpreter ships as a REPL (ReadโEvalโPrint Loop). To start it:
python bin/World.pyA prompt appears:
World >>
Type a program and press Enter to execute it.
| Command | Action |
|---|---|
world() |
Run WorldLang Source Files |
libman |
Run the library manager and download .world libraries |
langman |
Run the language manager and download language packs |
extman |
Run the extension manager and download extensions |
setlang |
Manually select a programming language or enable automatic detection |
translate() |
Translate WorldLang source code between supported languages |
WorldLang supports a hybrid language-selection system.
You can explicitly select the language you want to use, or leave the language unset and allow the interpreter to automatically detect the language of the source code.
Use:
setlang
Example:
setlang -> ArabicKW
This manually configures WorldLang to use the Arabic keyword table.
Leave the language input blank:
setlang -> ""
This enables automatic language detection.
When automatic detection is enabled, WorldLang analyzes the source code and determines the appropriate language during the lexing/tokenizing phase.
This allows code and imported modules written in different supported languages to run without manually switching the active language beforehand.
The automatic language detection system uses:
KerasNLTKNumPy
The detection system is optional when manually selecting a language with setlang.
WorldLang includes an integrated cross-language code translator.
Instead of translating code using simple text replacement, the translator processes the source through a structured multilingual pipeline:
Source
โ
Lexer
โ
Translator
โ
DeLexer
โ
Translated Source
The source code is first lexed into language-independent representations. The translator then maps those representations to the target language before the DeLexer reconstructs valid WorldLang source code.
translate(filename.world, source_language, target_language)
Example:
translate("factorial.world", "English", "Chinese")
WorldLang automatically generates a translated source file using the target language.
For example:
factorial_Chinese.world
This makes it possible to write a WorldLang program in one language and convert the same source code into another supported language.
The following factorial calculator can be written in Arabic:
# ุญุงุณุจุฉ ุงูู
ุถุฑูุจ
ู
ุชุบูุฑ ุงูุฑูู
= ุนุฏุฏ_ุตุญูุญ(ุงุณุชูุจู("ุฃุฏุฎู ุฑูู
ุงู"))
ุฏุงูุฉ ู
ุถุฑูุจ(ุฑูู
)
ุงุฐุง ุฑูู
== 1 ุงู ุฑูู
== 0 ููุฐ ุงุฑุฌุงุน 1
ุงุฑุฌุงุน ุฑูู
* ู
ุถุฑูุจ(ุฑูู
- 1)
ููุงูุฉ
ุทุจุงุนุฉ(ู
ุถุฑูุจ(ุงูุฑูู
))
The same program can also be written in English:
# Factorial Calculator
var number = int(input("Enter a number:"))
func factorial(number)
if number == 1 or number == 0 do return 1
return number * factorial(number - 1)
end
print(factorial(number))
When automatic detection is enabled, WorldLang can determine which supported language the source code uses without requiring a manual language change.
The interpreter exposes several Python-backed libraries, registered as native WorldLang functions:
| Library | Purpose | Backing module |
|---|---|---|
String |
split, uppercase, lowercase, contains, replace, ... |
_builtins/String.py |
Random |
Random number generation | _builtins/Random.py |
os |
Filesystem operations: chdir, mkdir, list_dir, move, system, ... |
_builtins/os.py |
Image |
Load/save images and convert to/from RGB lists | _builtins/Image.py |
Graph |
plot, scatter, bar charting |
_builtins/Graph.py |
Controls |
Mouse/keyboard automation | _builtins/Controls.py |
Serial |
Hardware/Arduino serial communication (send/receive) |
_builtins/Serial.py |
Speech |
Text-to-speech and voice recognition | _builtins/Speech.py |
GenAI |
Generative AI via Google Gemini | _builtins/GenAI.py |
WorldLang is a tree-walking interpreter with an extended multilingual processing architecture.
Source Code
โ
Language Selection / AI Detection
โ
Lexer
โ
Tokens
โ
Parser
โ
Abstract Syntax Tree
โ
Runtime
โ
Result
The language detection layer allows WorldLang to dynamically determine which keyword table should be used before tokenization when no language has been manually selected.
Source
โ
Lexer
โ
Language-Independent Representation
โ
Translator
โ
DeLexer
โ
Translated Source
This architecture allows WorldLang to execute and translate multilingual source code while keeping the underlying interpreter pipeline language-independent.
| File / Component | Role |
|---|---|
World.py |
Entry point and REPL shell |
Lexer.py |
Tokenizer; dynamically maps keywords from the detected or selected language table |
Parser.py |
Grammar rules and AST generation |
Interpreter.py |
Executes the AST and provides the standard library |
Tokens.py |
Token types and keyword handling |
Translator.py |
Converts tokenized source representations between supported languages |
DeLexer.py |
Reconstructs source code using the target language's keyword mappings |
Errors.py |
Error types (IllegalChar, Syntax, Runtime) |
RT_result.py |
Runtime results, contexts, and symbol tables |
datatypes/ |
Value, Number, String, List, Dict, Function |
_builtins/ |
Python-backed standard libraries |
data/ |
Language keyword tables and multilingual language resources |
The keyword tables are data-driven JSON files, allowing additional languages to be added without rewriting the core interpreter grammar.
WorldLang can fetch resources from the network at runtime:
langmanโ download keyword tables for additional languages intodata/.libmanโ download.worldlibraries.extmanโ download extensions intoextensions/.setlangโ manually configure a language or enable AI-based automatic language detection.translate()โ convert WorldLang source files between supported languages.
Language detection and translation operate on the multilingual keyword architecture, allowing different language packs to share the same underlying interpreter.
WorldLang is open-source and community-driven. Contributions are welcome in many forms:
- Language contributors โ add or improve localization and keyword tables.
- Compiler developers โ improve the lexer, parser, translator, DeLexer, runtime, and standard library.
- AI developers โ improve automatic language detection models and preprocessing.
- Hardware developers โ expand hardware and robotics integrations.
- Testers โ discover bugs and improve reliability.
- Everyone โ report issues, improve documentation, and share ideas.
To contribute:
- Fork the repository.
- Clone your fork and create a branch.
- Make your changes and commit them.
- Open a Pull Request to the
mainbranch.
WorldLang is released under the MIT License.
