move docs to docs/ folder, rewrite readme and contributing

This commit is contained in:
2026-05-16 11:35:35 -05:00
parent 439e555e50
commit 0ff6b2483e
6 changed files with 271 additions and 109 deletions

View File

@@ -1,7 +1,8 @@
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.
Write Python in any human language.
ForeignThon transpiles `.es.py`, `.ta.py` (and more) into standard Python. Keywords, builtins, exceptions — all translated. Errors come back in your language too.
```python
# hola.es.py
@@ -19,7 +20,7 @@ fpy run hola.es.py
# Hola, mundo 2!
```
## Installation
## Install
```bash
pip install foreignthon
@@ -27,62 +28,13 @@ pip install foreignthon-es # Spanish
pip install foreignthon-ta # Tamil
```
## Usage
## Docs
```bash
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
```python
# foreignthon: es
# ^ overrides the file extension
```
Or via CLI flag:
```bash
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:
- **keywords** — `si → if`, `para → for`, `definir → def`
- **builtins** — `imprimir → print`, `rango → range`
- **exceptions** — `ErrorDeValor → ValueError`
- **error_messages** — bilingual error output
- **stdlib** — `matematicas → math`
Validate your pack before publishing:
```bash
fpy pack mylang.json
```
## Development
```bash
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
```
- [Getting Started](docs/getting-started.md)
- [Language Packs](docs/language-packs.md)
- [Postfix Syntax](docs/postfix-syntax.md)
- [Contributing](docs/contributing.md)
- [Releasing](docs/releasing.md)
## License