fixed readme template
This commit is contained in:
164
README.md
164
README.md
@@ -1,36 +1,170 @@
|
|||||||
# foreignthon-{code}
|
<!-- =========================================================
|
||||||
|
FOREIGNTHON LANGUAGE PACK README TEMPLATE
|
||||||
|
---------------------------------------------------------
|
||||||
|
Replace every line marked ← REPLACE with real content.
|
||||||
|
Remove all comment blocks before publishing.
|
||||||
|
========================================================= -->
|
||||||
|
|
||||||
{language} language pack for ForeignThon.
|
# foreignthon-xx <!-- ← REPLACE xx with your language code, e.g. foreignthon-fr -->
|
||||||
|
|
||||||
|
<!-- ← REPLACE with a one-line description -->
|
||||||
|
French language pack for [ForeignThon](https://foreignthon.keshavanand.net/) — write Python in Français.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## Install
|
## Install
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
pip install foreignthon foreignthon-{code}
|
pip install foreignthon foreignthon-xx
|
||||||
```
|
```
|
||||||
|
|
||||||
## Usage
|
<!-- ← REPLACE xx in the line above -->
|
||||||
|
|
||||||
```py
|
---
|
||||||
fpy run main.{code}.py
|
|
||||||
|
## Example
|
||||||
|
|
||||||
|
<!-- =========================================================
|
||||||
|
Write a short .xx.py file that shows your language in action.
|
||||||
|
Good things to include: a loop, a conditional, a function,
|
||||||
|
print, and at least one exception type.
|
||||||
|
Then show the compiled Python output below it so readers can
|
||||||
|
see the direct mapping.
|
||||||
|
========================================================= -->
|
||||||
|
|
||||||
|
**`fizzbuzz.xx.py`**
|
||||||
|
|
||||||
|
```python
|
||||||
|
<!-- ← REPLACE this block with a real .xx.py file in your language -->
|
||||||
|
pour i dans intervalle(1, 21):
|
||||||
|
si i % 15 == 0:
|
||||||
|
afficher("FizzBuzz")
|
||||||
|
sinonsi i % 3 == 0:
|
||||||
|
afficher("Fizz")
|
||||||
|
sinonsi i % 5 == 0:
|
||||||
|
afficher("Buzz")
|
||||||
|
sinon:
|
||||||
|
afficher(i)
|
||||||
```
|
```
|
||||||
|
|
||||||
## What's translated
|
<!-- ← REPLACE the block above. Run fpy compile fizzbuzz.xx.py to get the output below -->
|
||||||
|
|
||||||
- **Keywords** — {keywords}
|
Compiles to standard Python:
|
||||||
- **Builtins** — {builtins}
|
|
||||||
- **Exceptions** — {exceptions}
|
|
||||||
- **Stdlib** — {stdlib}
|
|
||||||
|
|
||||||
{postfix_section}
|
```python
|
||||||
|
for i in range(1, 21):
|
||||||
|
if i % 15 == 0:
|
||||||
|
print("FizzBuzz")
|
||||||
|
elif i % 3 == 0:
|
||||||
|
print("Fizz")
|
||||||
|
elif i % 5 == 0:
|
||||||
|
print("Buzz")
|
||||||
|
else:
|
||||||
|
print(i)
|
||||||
|
```
|
||||||
|
|
||||||
|
Run it directly without compiling first:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
fpy run fizzbuzz.xx.py
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Keyword reference
|
||||||
|
|
||||||
|
<!-- =========================================================
|
||||||
|
Fill in the most important keyword mappings.
|
||||||
|
You don't need to list every single one — pick the ones
|
||||||
|
a new user would reach for first.
|
||||||
|
========================================================= -->
|
||||||
|
|
||||||
|
| Python | <!-- ← language name, e.g. Français --> |
|
||||||
|
|---|---|
|
||||||
|
| `if` | <!-- ← your word --> |
|
||||||
|
| `else` | <!-- ← your word --> |
|
||||||
|
| `elif` | <!-- ← your word --> |
|
||||||
|
| `for` | <!-- ← your word --> |
|
||||||
|
| `while` | <!-- ← your word --> |
|
||||||
|
| `def` | <!-- ← your word --> |
|
||||||
|
| `class` | <!-- ← your word --> |
|
||||||
|
| `return` | <!-- ← your word --> |
|
||||||
|
| `import` | <!-- ← your word --> |
|
||||||
|
| `True` | <!-- ← your word --> |
|
||||||
|
| `False` | <!-- ← your word --> |
|
||||||
|
| `None` | <!-- ← your word --> |
|
||||||
|
| `print` | <!-- ← your word --> |
|
||||||
|
| `input` | <!-- ← your word --> |
|
||||||
|
| `len` | <!-- ← your word --> |
|
||||||
|
| `range` | <!-- ← your word --> |
|
||||||
|
|
||||||
|
The full mapping is in [`xx.json`](https://git.keshavanand.net/foreign-thon/foreignthon-xx/raw/branch/main/src/foreignthon_xx/xx.json).
|
||||||
|
|
||||||
|
<!-- ← REPLACE xx in the line above with your language code -->
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
<!-- =========================================================
|
||||||
|
POSTFIX SECTION — only include this if your language uses
|
||||||
|
SOV (subject-object-verb) word order, i.e. postfix_keywords
|
||||||
|
in your JSON is non-empty. Delete this entire section if
|
||||||
|
your language is SVO (like Spanish, French, etc.).
|
||||||
|
========================================================= -->
|
||||||
|
|
||||||
|
## Postfix syntax
|
||||||
|
|
||||||
|
<!-- ← REPLACE the example below with one from your language -->
|
||||||
|
This pack supports the `@@` postfix operator for natural SOV word order.
|
||||||
|
Instead of writing the keyword first:
|
||||||
|
|
||||||
|
```python
|
||||||
|
ஆனால் x > 0:
|
||||||
|
பதிப்பி(x)
|
||||||
|
```
|
||||||
|
|
||||||
|
You can write it in natural Tamil order — condition first, keyword after:
|
||||||
|
|
||||||
|
```python
|
||||||
|
x > 0 @@ஆனால்:
|
||||||
|
பதிப்பி(x)
|
||||||
|
```
|
||||||
|
|
||||||
|
Both compile to the same Python. Decompile with postfix output using:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
fpy decompile script.py --lang xx --postfix
|
||||||
|
```
|
||||||
|
|
||||||
|
See [Postfix Syntax](https://foreignthon.keshavanand.net/postfix-syntax/) for full details.
|
||||||
|
|
||||||
|
<!-- END POSTFIX SECTION -->
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Start a project
|
||||||
|
|
||||||
|
```bash
|
||||||
|
fpy new myproject --lang xx
|
||||||
|
cd myproject
|
||||||
|
fpy run src/main.xx.py
|
||||||
|
```
|
||||||
|
|
||||||
|
<!-- ← REPLACE xx above -->
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## Documentation
|
## Documentation
|
||||||
|
|
||||||
→ https://foreignthon.keshavanand.net/
|
→ [foreignthon.keshavanand.net](https://foreignthon.keshavanand.net/)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
Found a missing translation or a better keyword choice? Open an issue or PR — no core access needed.
|
Found a missing translation or a better keyword for your language? Open an issue or PR — no access to the core repo is needed.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
GPL
|
GPL v3
|
||||||
|
|||||||
Reference in New Issue
Block a user