readmes and mds plus fixed ruff
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
# Contributing to ForeignThon
|
||||
|
||||
## Project structure
|
||||
foreignthon/
|
||||
├── packages/
|
||||
│ ├── foreignthon/ # core engine + fpy CLI
|
||||
│ │ ├── src/foreignthon/
|
||||
│ │ │ ├── cli.py # fpy commands
|
||||
│ │ │ ├── transpiler.py # tokenizer-based transpiler
|
||||
│ │ │ ├── pack.py # language pack loader
|
||||
│ │ │ └── errors.py # bilingual error hook
|
||||
│ │ └── tests/
|
||||
│ └── langs/
|
||||
│ └── es/ # Spanish language pack
|
||||
│ └── src/foreignthon_es/es.json
|
||||
|
||||
## Setting up
|
||||
|
||||
```bash
|
||||
python -m venv .venv && source .venv/bin/activate
|
||||
pip install -e "packages/foreignthon[dev]"
|
||||
pip install -e packages/langs/es
|
||||
```
|
||||
|
||||
## Running tests
|
||||
|
||||
```bash
|
||||
pytest packages/foreignthon/tests/ -v
|
||||
```
|
||||
|
||||
## Adding a new language pack
|
||||
|
||||
1. Copy `packages/langs/es/` to `packages/langs/<code>/`
|
||||
2. Rename `foreignthon_es` → `foreignthon_<code>` throughout
|
||||
3. Fill in `<code>.json` following the same schema as `es.json`
|
||||
4. Validate it: `fpy pack packages/langs/<code>/src/foreignthon_<code>/<code>.json`
|
||||
5. Add tests if the language has tricky characters or edge cases
|
||||
6. Open a PR or publish independently as `foreignthon-<code>` on PyPI
|
||||
|
||||
## Language pack schema
|
||||
|
||||
Every pack must have these top-level keys:
|
||||
`meta`, `keywords`, `builtins`, `exceptions`, `error_messages`, `stdlib`
|
||||
|
||||
See `packages/langs/es/src/foreignthon_es/es.json` as the reference.
|
||||
|
||||
## Code style
|
||||
|
||||
```bash
|
||||
ruff check packages/foreignthon/src
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user