This repository has been archived on 2026-05-19. You can view files and clone it. You cannot open issues or pull requests or push a commit.
2026-05-15 19:22:25 -05:00
2026-05-15 19:06:09 -05:00
2026-05-15 18:53:00 -05:00
2026-05-15 18:41:13 -05:00
2026-05-15 19:06:09 -05:00

DME.md << 'EOF'

ForeignThon

Write Python in any human language. ForeignThon transpiles .es.py, .ta.py (and more) files into standard Python — keywords, builtins, exceptions, all of it.

# hola.es.py
definir saludar(nombre):
    retornar f"Hola, {nombre}!"

para i en rango(3):
    imprimir(saludar(f"mundo {i}"))
fpy run hola.es.py
# Hola, mundo 0!
# Hola, mundo 1!
# Hola, mundo 2!

Installation

pip install foreignthon
pip install foreignthon-es   # Spanish
pip install foreignthon-ta   # Tamil

Usage

fpy run script.es.py            # transpile and run
fpy compile script.es.py        # output a .compiled.py file
fpy check script.es.py          # validate without running
fpy pack mylang.json            # validate a language pack

Language override

# foreignthon: es
# ^ overrides the file extension

Or via CLI flag:

fpy run script.py --lang es

Errors

Errors are shown in your language first, English below: [ES] ErrorDeDivisionCero: Error: división por cero [EN] ZeroDivisionError: division by zero

Language Packs

A language pack is a JSON file + a tiny Python wrapper published as foreignthon-xx on PyPI. See packages/langs/es/ for the reference implementation.

The JSON covers:

  • keywordssi → if, para → for, definir → def
  • builtinsimprimir → print, rango → range
  • exceptionsErrorDeValor → ValueError
  • error_messages — bilingual error output
  • stdlibmatematicas → math

Validate your pack before publishing:

fpy pack mylang.json

Development

git clone <your-repo>
cd foreignthon
python -m venv .venv && source .venv/bin/activate
pip install -e "packages/foreignthon[dev]"
pip install -e packages/langs/es
pytest packages/foreignthon/tests/ -v

License

GPL

Description
A naive solution for foreign language coders to code with their native language into python code.
Readme GPL-3.0 125 KiB
Languages
Python 100%