43 lines
1.1 KiB
Markdown
43 lines
1.1 KiB
Markdown
# ForeignThon
|
|
|
|
Write Python in any human language.
|
|
|
|
ForeignThon is a transpiler that converts `.xx.py` files into standard Python — keywords, builtins, and exceptions all translated into your language. The compiled output runs anywhere without ForeignThon installed.
|
|
|
|
---
|
|
|
|
## How it works
|
|
|
|
```
|
|
source.es.py → fpy → source.compiled.py → Python
|
|
```
|
|
|
|
ForeignThon uses Python's `tokenize` module to swap `NAME` tokens. Strings, comments, and f-strings are never touched. The result is identical, valid Python.
|
|
|
|
---
|
|
|
|
## Install
|
|
|
|
```bash
|
|
pip install foreignthon
|
|
pip install foreignthon-es # or any other language pack
|
|
```
|
|
|
|
---
|
|
|
|
## At a glance
|
|
|
|
| Feature | Description |
|
|
|---|---|
|
|
| Transpiler | Tokenizer-based, safe, unicode-aware |
|
|
| File format | `.xx.py` where `xx` is the language code |
|
|
| Errors | Shown in your language first, English below |
|
|
| Postfix syntax | `@@` operator for SOV languages |
|
|
| Custom packs | Local JSON override, no PyPI needed |
|
|
| CLI | `fpy run`, `fpy compile`, `fpy decompile`, `fpy new` |
|
|
|
|
---
|
|
|
|
[Get started →](getting-started.md){ .md-button .md-button--primary }
|
|
[CLI Reference →](cli-reference.md){ .md-button }
|