frython 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- frython-1.0.0/LICENSE +21 -0
- frython-1.0.0/PKG-INFO +588 -0
- frython-1.0.0/README.md +549 -0
- frython-1.0.0/frython.egg-info/PKG-INFO +588 -0
- frython-1.0.0/frython.egg-info/SOURCES.txt +9 -0
- frython-1.0.0/frython.egg-info/dependency_links.txt +1 -0
- frython-1.0.0/frython.egg-info/entry_points.txt +2 -0
- frython-1.0.0/frython.egg-info/top_level.txt +1 -0
- frython-1.0.0/setup.cfg +4 -0
- frython-1.0.0/setup.py +52 -0
- frython-1.0.0/tests/test_frython.py +291 -0
frython-1.0.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 La Communauté Frython
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
frython-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,588 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: frython
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: 🐓 Python en français, sacré bleu !
|
|
5
|
+
Home-page: https://github.com/Artleboss2/frython
|
|
6
|
+
Author: La Communauté Frython
|
|
7
|
+
Author-email: frython@example.com
|
|
8
|
+
Project-URL: Bug Reports, https://github.com/Artleboss2/frython/issues
|
|
9
|
+
Project-URL: Source, https://github.com/Artleboss2/frython
|
|
10
|
+
Project-URL: Documentation, https://github.com/Artleboss2/frython#readme
|
|
11
|
+
Keywords: python français french programming language transpiler
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Intended Audience :: Education
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Topic :: Software Development :: Compilers
|
|
23
|
+
Classifier: Topic :: Software Development :: Interpreters
|
|
24
|
+
Classifier: Natural Language :: French
|
|
25
|
+
Requires-Python: >=3.8
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
License-File: LICENSE
|
|
28
|
+
Dynamic: author
|
|
29
|
+
Dynamic: author-email
|
|
30
|
+
Dynamic: classifier
|
|
31
|
+
Dynamic: description
|
|
32
|
+
Dynamic: description-content-type
|
|
33
|
+
Dynamic: home-page
|
|
34
|
+
Dynamic: keywords
|
|
35
|
+
Dynamic: license-file
|
|
36
|
+
Dynamic: project-url
|
|
37
|
+
Dynamic: requires-python
|
|
38
|
+
Dynamic: summary
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
______ _ _
|
|
44
|
+
| ____| | | | |
|
|
45
|
+
| |__ _ __ _ _| |_| |__ ___ _ __
|
|
46
|
+
| __| '__| | | | __| '_ \ / _ \| '_ \
|
|
47
|
+
| | | | | |_| | |_| | | | (_) | | | |
|
|
48
|
+
|_| |_| \__, |\__|_| |_|\___/|_| |_|
|
|
49
|
+
__/ |
|
|
50
|
+
|___/
|
|
51
|
+
```
|
|
52
|
+
<div align="center">
|
|
53
|
+
# 🐓 Frython
|
|
54
|
+
|
|
55
|
+
### *Python en français, sacré bleu !*
|
|
56
|
+
|
|
57
|
+
[](https://python.org)
|
|
58
|
+
[](LICENSE)
|
|
59
|
+
[](https://github.com/Artleboss2/frython/releases)
|
|
60
|
+
[](tests/)
|
|
61
|
+
[](https://github.com/Artleboss2/frython)
|
|
62
|
+
|
|
63
|
+
[](https://github.com/Artleboss2/frython)
|
|
64
|
+
[](https://github.com/Artleboss2/frython)
|
|
65
|
+
[](https://python.org)
|
|
66
|
+
|
|
67
|
+
</div>
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## 🥐 Qu'est-ce que c'est ?
|
|
72
|
+
|
|
73
|
+
**Frython** est un langage de programmation qui transpile du code Python écrit **entièrement en français** vers du Python standard. C'est un projet humoristique, mais **entièrement fonctionnel** — vous pouvez vraiment programmer en français !
|
|
74
|
+
|
|
75
|
+
Frython traduit les mots-clés Python (`if`, `while`, `for`, `print`, etc.) en leurs équivalents français (`si`, `tantque`, `pour`, `afficher`, etc.).
|
|
76
|
+
|
|
77
|
+
> *"Pourquoi programmer en anglais quand on peut le faire en français avec 3 fois plus de mots ?" — Victor Hugo, probablement*
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
## ⚡ Installation
|
|
82
|
+
|
|
83
|
+
### Depuis PyPI *(bientôt disponible)*
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
pip install frython
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Depuis les sources
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
git clone https://github.com/Artleboss2/frython.git
|
|
93
|
+
cd frython
|
|
94
|
+
pip install -e .
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Vérifier l'installation
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
frython --version
|
|
101
|
+
# Frython 1.0.0 — Python en français 🐓
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
## 🚀 Démarrage rapide
|
|
107
|
+
|
|
108
|
+
### Votre premier programme Frython
|
|
109
|
+
|
|
110
|
+
Créez un fichier `bonjour.fy` :
|
|
111
|
+
|
|
112
|
+
```python
|
|
113
|
+
# bonjour.fy
|
|
114
|
+
afficher("Bonjour le monde! 🐓")
|
|
115
|
+
|
|
116
|
+
prenom = "Marie"
|
|
117
|
+
age = 25
|
|
118
|
+
|
|
119
|
+
si age >= 18:
|
|
120
|
+
afficher(f"Bienvenue, {prenom}! Vous êtes majeur(e).")
|
|
121
|
+
sinon:
|
|
122
|
+
afficher(f"Bonjour, {prenom}! Vous êtes mineur(e).")
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
Exécutez-le :
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
frython bonjour.fy
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
```
|
|
132
|
+
Bonjour le monde! 🐓
|
|
133
|
+
Bienvenue, Marie! Vous êtes majeur(e).
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### REPL Interactive
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
frython
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
```
|
|
143
|
+
_____ _____ _ _
|
|
144
|
+
...
|
|
145
|
+
|
|
146
|
+
🐓 Frython v1.0.0 — Python en français, sacré bleu !
|
|
147
|
+
Tapez 'aide()' pour de l'aide, 'quitter()' pour sortir.
|
|
148
|
+
|
|
149
|
+
🐓 >>> afficher("Ça marche!")
|
|
150
|
+
Ça marche!
|
|
151
|
+
🐓 >>> x = 42
|
|
152
|
+
🐓 >>> x * 2
|
|
153
|
+
84
|
|
154
|
+
🐓 >>> quitter()
|
|
155
|
+
Au revoir! 👋
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
## 📖 Référence du langage
|
|
161
|
+
|
|
162
|
+
### Structures de contrôle
|
|
163
|
+
|
|
164
|
+
| Frython | Python | Description |
|
|
165
|
+
|---------|--------|-------------|
|
|
166
|
+
| `si` | `if` | Condition |
|
|
167
|
+
| `sinon` | `else` | Sinon |
|
|
168
|
+
| `sinonsi` | `elif` | Sinon si |
|
|
169
|
+
| `tantque` | `while` | Boucle tant que |
|
|
170
|
+
| `pour` | `for` | Boucle pour |
|
|
171
|
+
| `dans` | `in` | Opérateur dans |
|
|
172
|
+
| `casser` | `break` | Sortir d'une boucle |
|
|
173
|
+
| `continuer` | `continue` | Itération suivante |
|
|
174
|
+
| `passer` | `pass` | Ne rien faire |
|
|
175
|
+
|
|
176
|
+
### Définitions
|
|
177
|
+
|
|
178
|
+
| Frython | Python | Description |
|
|
179
|
+
|---------|--------|-------------|
|
|
180
|
+
| `déf` | `def` | Définir une fonction |
|
|
181
|
+
| `retourner` | `return` | Retourner une valeur |
|
|
182
|
+
| `classe` | `class` | Définir une classe |
|
|
183
|
+
| `soi` | `self` | Instance courante |
|
|
184
|
+
| `lambda` | `lambda` | Fonction anonyme |
|
|
185
|
+
| `rendement` | `yield` | Générateur |
|
|
186
|
+
|
|
187
|
+
### Valeurs spéciales
|
|
188
|
+
|
|
189
|
+
| Frython | Python | Description |
|
|
190
|
+
|---------|--------|-------------|
|
|
191
|
+
| `Vrai` | `True` | Vrai |
|
|
192
|
+
| `Faux` | `False` | Faux |
|
|
193
|
+
| `Rien` | `None` | Nul |
|
|
194
|
+
|
|
195
|
+
### Opérateurs logiques
|
|
196
|
+
|
|
197
|
+
| Frython | Python | Description |
|
|
198
|
+
|---------|--------|-------------|
|
|
199
|
+
| `et` | `and` | Et logique |
|
|
200
|
+
| `ou` | `or` | Ou logique |
|
|
201
|
+
| `non` | `not` | Négation |
|
|
202
|
+
| `est` | `is` | Identité |
|
|
203
|
+
| `pasdans` | `not in` | Non présent dans |
|
|
204
|
+
|
|
205
|
+
### Imports et modules
|
|
206
|
+
|
|
207
|
+
| Frython | Python | Description |
|
|
208
|
+
|---------|--------|-------------|
|
|
209
|
+
| `importer` | `import` | Importer un module |
|
|
210
|
+
| `de` | `from` | Importer depuis |
|
|
211
|
+
| `comme` | `as` | Alias |
|
|
212
|
+
|
|
213
|
+
```python
|
|
214
|
+
# Importation en Frython
|
|
215
|
+
importer mathématiques
|
|
216
|
+
de collections importer defaultdict comme dd_fr
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
### Gestion des exceptions
|
|
220
|
+
|
|
221
|
+
| Frython | Python | Description |
|
|
222
|
+
|---------|--------|-------------|
|
|
223
|
+
| `essayer` | `try` | Bloc essai |
|
|
224
|
+
| `sauf` | `except` | Attraper une exception |
|
|
225
|
+
| `enfin` | `finally` | Toujours exécuter |
|
|
226
|
+
| `lever` | `raise` | Lever une exception |
|
|
227
|
+
| `affirmer` | `assert` | Assertion |
|
|
228
|
+
|
|
229
|
+
### Fonctions intégrées
|
|
230
|
+
|
|
231
|
+
| Frython | Python | Description |
|
|
232
|
+
|---------|--------|-------------|
|
|
233
|
+
| `afficher()` | `print()` | Afficher du texte |
|
|
234
|
+
| `saisir()` | `input()` | Lire une entrée |
|
|
235
|
+
| `longueur()` | `len()` | Longueur |
|
|
236
|
+
| `intervalle()` | `range()` | Suite de nombres |
|
|
237
|
+
| `liste()` | `list()` | Convertir en liste |
|
|
238
|
+
| `dictionnaire()` | `dict()` | Créer un dictionnaire |
|
|
239
|
+
| `ensemble()` | `set()` | Créer un ensemble |
|
|
240
|
+
| `tuple()` | `tuple()` | Créer un tuple |
|
|
241
|
+
| `entier()` | `int()` | Convertir en entier |
|
|
242
|
+
| `decimal()` | `float()` | Convertir en décimal |
|
|
243
|
+
| `chaine()` | `str()` | Convertir en chaîne |
|
|
244
|
+
| `booleen()` | `bool()` | Convertir en booléen |
|
|
245
|
+
| `enumerer()` | `enumerate()` | Énumérer |
|
|
246
|
+
| `zipper()` | `zip()` | Zipper |
|
|
247
|
+
| `mapper()` | `map()` | Mapper |
|
|
248
|
+
| `filtrer()` | `filter()` | Filtrer |
|
|
249
|
+
| `trier()` | `sorted()` | Trier |
|
|
250
|
+
| `inverser()` | `reversed()` | Inverser |
|
|
251
|
+
| `somme()` | `sum()` | Sommer |
|
|
252
|
+
| `maximum()` | `max()` | Maximum |
|
|
253
|
+
| `minimum()` | `min()` | Minimum |
|
|
254
|
+
| `absolu()` | `abs()` | Valeur absolue |
|
|
255
|
+
| `arrondir()` | `round()` | Arrondir |
|
|
256
|
+
| `type()` | `type()` | Type d'un objet |
|
|
257
|
+
| `aide()` | `help()` | Aide |
|
|
258
|
+
|
|
259
|
+
### Méthodes de chaînes
|
|
260
|
+
|
|
261
|
+
| Frython | Python | Description |
|
|
262
|
+
|---------|--------|-------------|
|
|
263
|
+
| `.majuscule()` | `.upper()` | Majuscules |
|
|
264
|
+
| `.minuscule()` | `.lower()` | Minuscules |
|
|
265
|
+
| `.capitaliser()` | `.capitalize()` | Première lettre majuscule |
|
|
266
|
+
| `.titrer()` | `.title()` | Format titre |
|
|
267
|
+
| `.remplacer()` | `.replace()` | Remplacer |
|
|
268
|
+
| `.diviser()` | `.split()` | Diviser |
|
|
269
|
+
| `.joindre()` | `.join()` | Joindre |
|
|
270
|
+
| `.supprimer_espaces()` | `.strip()` | Supprimer espaces |
|
|
271
|
+
| `.commencer_par()` | `.startswith()` | Commence par |
|
|
272
|
+
| `.finir_par()` | `.endswith()` | Finit par |
|
|
273
|
+
| `.trouver()` | `.find()` | Trouver |
|
|
274
|
+
| `.formater()` | `.format()` | Formater |
|
|
275
|
+
| `.compter()` | `.count()` | Compter |
|
|
276
|
+
|
|
277
|
+
### Méthodes de listes
|
|
278
|
+
|
|
279
|
+
| Frython | Python | Description |
|
|
280
|
+
|---------|--------|-------------|
|
|
281
|
+
| `.ajouter()` | `.append()` | Ajouter un élément |
|
|
282
|
+
| `.inserer()` | `.insert()` | Insérer à un indice |
|
|
283
|
+
| `.etendre()` | `.extend()` | Étendre avec une liste |
|
|
284
|
+
| `.retirer()` | `.remove()` | Retirer un élément |
|
|
285
|
+
| `.extraire()` | `.pop()` | Extraire un élément |
|
|
286
|
+
| `.vider()` | `.clear()` | Vider la liste |
|
|
287
|
+
| `.trier()` | `.sort()` | Trier sur place |
|
|
288
|
+
| `.inverser()` | `.reverse()` | Inverser sur place |
|
|
289
|
+
| `.copier()` | `.copy()` | Copier |
|
|
290
|
+
| `.compter()` | `.count()` | Compter les occurrences |
|
|
291
|
+
|
|
292
|
+
### Méthodes de dictionnaires
|
|
293
|
+
|
|
294
|
+
| Frython | Python | Description |
|
|
295
|
+
|---------|--------|-------------|
|
|
296
|
+
| `.cles()` | `.keys()` | Clés |
|
|
297
|
+
| `.valeurs()` | `.values()` | Valeurs |
|
|
298
|
+
| `.elements()` | `.items()` | Paires clé-valeur |
|
|
299
|
+
| `.obtenir()` | `.get()` | Obtenir avec défaut |
|
|
300
|
+
| `.mettre_a_jour()` | `.update()` | Mettre à jour |
|
|
301
|
+
| `.extraire()` | `.pop()` | Extraire |
|
|
302
|
+
| `.vider()` | `.clear()` | Vider |
|
|
303
|
+
|
|
304
|
+
---
|
|
305
|
+
|
|
306
|
+
## 💡 Exemples
|
|
307
|
+
|
|
308
|
+
### Fibonacci
|
|
309
|
+
|
|
310
|
+
```python
|
|
311
|
+
# fibonacci.fy
|
|
312
|
+
déf fibonacci(n):
|
|
313
|
+
"""Calcule la suite de Fibonacci."""
|
|
314
|
+
si n <= 0:
|
|
315
|
+
retourner []
|
|
316
|
+
sinonsi n == 1:
|
|
317
|
+
retourner [0]
|
|
318
|
+
|
|
319
|
+
suite = [0, 1]
|
|
320
|
+
tantque longueur(suite) < n:
|
|
321
|
+
suivant = suite[-1] + suite[-2]
|
|
322
|
+
suite.ajouter(suivant)
|
|
323
|
+
|
|
324
|
+
retourner suite
|
|
325
|
+
|
|
326
|
+
nombres = fibonacci(10)
|
|
327
|
+
afficher(nombres)
|
|
328
|
+
# [0, 1, 1, 2, 3, 5, 8, 13, 21, 34]
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
### Programmation orientée objet
|
|
332
|
+
|
|
333
|
+
```python
|
|
334
|
+
# classes.fy
|
|
335
|
+
classe Animal:
|
|
336
|
+
def __init__(soi, nom, age):
|
|
337
|
+
soi.nom = nom
|
|
338
|
+
soi.age = age
|
|
339
|
+
|
|
340
|
+
déf parler(soi):
|
|
341
|
+
retourner "..."
|
|
342
|
+
|
|
343
|
+
classe Chien(Animal):
|
|
344
|
+
déf parler(soi):
|
|
345
|
+
retourner "Ouaf! 🐕"
|
|
346
|
+
|
|
347
|
+
déf chercher(soi, objet):
|
|
348
|
+
afficher(f"{soi.nom} cherche {objet}... trouvé!")
|
|
349
|
+
|
|
350
|
+
rex = Chien("Rex", 3)
|
|
351
|
+
afficher(rex.parler()) # Ouaf! 🐕
|
|
352
|
+
rex.chercher("la balle") # Rex cherche la balle... trouvé!
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
### Compréhensions de liste
|
|
356
|
+
|
|
357
|
+
```python
|
|
358
|
+
# comprehensions.fy
|
|
359
|
+
nombres = liste(intervalle(1, 11))
|
|
360
|
+
|
|
361
|
+
carres = [x**2 pour x dans nombres]
|
|
362
|
+
pairs = [x pour x dans nombres si x % 2 == 0]
|
|
363
|
+
cube_pairs = [x**3 pour x dans nombres si x % 2 == 0]
|
|
364
|
+
|
|
365
|
+
afficher(f"Carrés: {carres}")
|
|
366
|
+
afficher(f"Pairs: {pairs}")
|
|
367
|
+
afficher(f"Cubes des pairs: {cube_pairs}")
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
### Gestion des exceptions
|
|
371
|
+
|
|
372
|
+
```python
|
|
373
|
+
# exceptions.fy
|
|
374
|
+
déf diviser_securement(a, b):
|
|
375
|
+
essayer:
|
|
376
|
+
resultat = a / b
|
|
377
|
+
retourner resultat
|
|
378
|
+
sauf ZeroDivisionError:
|
|
379
|
+
afficher("Erreur: Division par zéro!")
|
|
380
|
+
retourner Rien
|
|
381
|
+
enfin:
|
|
382
|
+
afficher("Opération terminée.")
|
|
383
|
+
|
|
384
|
+
afficher(diviser_securement(10, 2)) # 5.0
|
|
385
|
+
afficher(diviser_securement(10, 0)) # Erreur + Rien
|
|
386
|
+
```
|
|
387
|
+
|
|
388
|
+
### Fonctions d'ordre supérieur
|
|
389
|
+
|
|
390
|
+
```python
|
|
391
|
+
# ordre_superieur.fy
|
|
392
|
+
nombres = liste(intervalle(1, 11))
|
|
393
|
+
|
|
394
|
+
# mapper, filtrer, trier
|
|
395
|
+
carres = liste(mapper(lambda x: x**2, nombres))
|
|
396
|
+
pairs = liste(filtrer(lambda x: x % 2 == 0, nombres))
|
|
397
|
+
desc = trier(nombres, reverse=Vrai)
|
|
398
|
+
|
|
399
|
+
afficher(f"Carrés: {carres}")
|
|
400
|
+
afficher(f"Pairs: {pairs}")
|
|
401
|
+
afficher(f"Décroissant: {desc}")
|
|
402
|
+
|
|
403
|
+
# Réduction manuelle
|
|
404
|
+
total = somme(nombres)
|
|
405
|
+
afficher(f"Total: {total}")
|
|
406
|
+
```
|
|
407
|
+
|
|
408
|
+
---
|
|
409
|
+
|
|
410
|
+
## 🛠️ Utilisation en ligne de commande
|
|
411
|
+
|
|
412
|
+
```bash
|
|
413
|
+
# Lancer la REPL interactive
|
|
414
|
+
frython
|
|
415
|
+
|
|
416
|
+
# Exécuter un fichier .fy
|
|
417
|
+
frython mon_programme.fy
|
|
418
|
+
|
|
419
|
+
# Voir le code Python généré (transpilation)
|
|
420
|
+
frython -t mon_programme.fy
|
|
421
|
+
|
|
422
|
+
# Mode verbeux (affiche le code Python avant exécution)
|
|
423
|
+
frython -v mon_programme.fy
|
|
424
|
+
|
|
425
|
+
# Exécuter une commande directe
|
|
426
|
+
frython -c "afficher('Bonjour depuis la ligne de commande!')"
|
|
427
|
+
|
|
428
|
+
# Voir tous les mots-clés disponibles
|
|
429
|
+
frython --mots-cles
|
|
430
|
+
|
|
431
|
+
# Voir la version
|
|
432
|
+
frython --version
|
|
433
|
+
```
|
|
434
|
+
|
|
435
|
+
---
|
|
436
|
+
|
|
437
|
+
## 🐍 API Python
|
|
438
|
+
|
|
439
|
+
Vous pouvez utiliser Frython directement dans vos scripts Python :
|
|
440
|
+
|
|
441
|
+
```python
|
|
442
|
+
from frython import transpiler, InterpreteurFrython
|
|
443
|
+
|
|
444
|
+
# Transpiler du code Frython en Python
|
|
445
|
+
code_frython = """
|
|
446
|
+
déf saluer(nom):
|
|
447
|
+
retourner f"Bonjour, {nom}!"
|
|
448
|
+
|
|
449
|
+
afficher(saluer("Monde"))
|
|
450
|
+
"""
|
|
451
|
+
|
|
452
|
+
code_python = transpiler(code_frython)
|
|
453
|
+
print(code_python)
|
|
454
|
+
# def saluer(nom):
|
|
455
|
+
# return f"Bonjour, {nom}!"
|
|
456
|
+
# print(saluer("Monde"))
|
|
457
|
+
|
|
458
|
+
# Exécuter directement
|
|
459
|
+
interp = InterpreteurFrython()
|
|
460
|
+
interp.executer_source(code_frython)
|
|
461
|
+
# Bonjour, Monde!
|
|
462
|
+
```
|
|
463
|
+
|
|
464
|
+
---
|
|
465
|
+
|
|
466
|
+
## 🗂️ Structure du projet
|
|
467
|
+
|
|
468
|
+
```
|
|
469
|
+
frython/
|
|
470
|
+
├── frython/
|
|
471
|
+
│ ├── __init__.py # Point d'entrée du paquet
|
|
472
|
+
│ ├── lexeur.py # Lexeur/Tokenizer Frython
|
|
473
|
+
│ ├── transpileur.py # Transpileur Frython → Python
|
|
474
|
+
│ └── interpreteur.py # Interpréteur et REPL
|
|
475
|
+
├── exemples/
|
|
476
|
+
│ ├── bonjour_monde.fy # Hello World en Frython
|
|
477
|
+
│ ├── fibonacci.fy # Suite de Fibonacci
|
|
478
|
+
│ ├── classes.fy # POO en Frython
|
|
479
|
+
│ └── vitrine.fy # Démonstration complète
|
|
480
|
+
├── tests/
|
|
481
|
+
│ └── test_frython.py # Tests unitaires
|
|
482
|
+
├── __main__.py # CLI principale
|
|
483
|
+
├── setup.py # Configuration du paquet
|
|
484
|
+
├── pyproject.toml # Configuration moderne
|
|
485
|
+
├── LICENSE # Licence MIT
|
|
486
|
+
├── .gitignore # Fichiers ignorés par Git
|
|
487
|
+
└── README.md # Ce fichier
|
|
488
|
+
```
|
|
489
|
+
|
|
490
|
+
---
|
|
491
|
+
|
|
492
|
+
## 🧪 Tests
|
|
493
|
+
|
|
494
|
+
```bash
|
|
495
|
+
# Lancer tous les tests
|
|
496
|
+
python -m pytest tests/ -v
|
|
497
|
+
|
|
498
|
+
# Ou avec unittest
|
|
499
|
+
python -m unittest tests/test_frython.py -v
|
|
500
|
+
|
|
501
|
+
# Avec couverture de code
|
|
502
|
+
pip install pytest-cov
|
|
503
|
+
pytest tests/ --cov=frython --cov-report=html
|
|
504
|
+
```
|
|
505
|
+
|
|
506
|
+
---
|
|
507
|
+
|
|
508
|
+
## 🤝 Contribuer
|
|
509
|
+
|
|
510
|
+
Les contributions sont les bienvenues ! Voici comment participer :
|
|
511
|
+
|
|
512
|
+
1. **Forkez** le dépôt
|
|
513
|
+
2. Créez une **branche** pour votre fonctionnalité (`git checkout -b feature/ma-feature`)
|
|
514
|
+
3. **Committez** vos changements (`git commit -m 'Ajouter ma super feature'`)
|
|
515
|
+
4. **Poussez** la branche (`git push origin feature/ma-feature`)
|
|
516
|
+
5. Ouvrez une **Pull Request**
|
|
517
|
+
|
|
518
|
+
### Idées de contributions
|
|
519
|
+
|
|
520
|
+
- 🆕 Ajouter des mots-clés manquants
|
|
521
|
+
- 🐛 Corriger des bugs de transpilation
|
|
522
|
+
- 📚 Améliorer la documentation
|
|
523
|
+
- 🧪 Ajouter des tests
|
|
524
|
+
- 💡 Créer des exemples de programmes
|
|
525
|
+
- 🌍 Supporter d'autres langues ? (*Pythonisch ? Pythönen ?*)
|
|
526
|
+
|
|
527
|
+
---
|
|
528
|
+
|
|
529
|
+
## ❓ FAQ
|
|
530
|
+
|
|
531
|
+
**Q: Est-ce vraiment utilisable ?**
|
|
532
|
+
R: Oui ! Frython transpile vers Python valide. Tout ce que Python peut faire, Frython peut le faire — en français.
|
|
533
|
+
|
|
534
|
+
**Q: Puis-je utiliser des bibliothèques Python normales ?**
|
|
535
|
+
R: Absolument. `importer numpy comme np` fonctionne parfaitement.
|
|
536
|
+
|
|
537
|
+
**Q: Et les f-strings ?**
|
|
538
|
+
R: Les f-strings Python fonctionnent directement : `f"Bonjour {nom}!"`.
|
|
539
|
+
|
|
540
|
+
**Q: Les accents dans les noms de variables ?**
|
|
541
|
+
R: Frython supporte les caractères accentués pour les mots-clés et les méthodes.
|
|
542
|
+
|
|
543
|
+
**Q: Pourquoi ?**
|
|
544
|
+
R: *Pourquoi pas ?* 🥐
|
|
545
|
+
|
|
546
|
+
**Q: Mon patron va-t-il accepter du code Frython en production ?**
|
|
547
|
+
R: Nous ne pouvons pas garantir la santé de votre emploi.
|
|
548
|
+
|
|
549
|
+
---
|
|
550
|
+
|
|
551
|
+
## 📊 Compatibilité
|
|
552
|
+
|
|
553
|
+
| Python | Frython | Statut |
|
|
554
|
+
|--------|---------|--------|
|
|
555
|
+
| 3.8 | 1.0.0 | ✅ |
|
|
556
|
+
| 3.9 | 1.0.0 | ✅ |
|
|
557
|
+
| 3.10 | 1.0.0 | ✅ |
|
|
558
|
+
| 3.11 | 1.0.0 | ✅ |
|
|
559
|
+
| 3.12 | 1.0.0 | ✅ |
|
|
560
|
+
| 2.7 | — | ❌ On est en 2025 |
|
|
561
|
+
|
|
562
|
+
---
|
|
563
|
+
|
|
564
|
+
## 📜 Licence
|
|
565
|
+
|
|
566
|
+
Ce projet est sous licence [MIT](LICENSE). Vous êtes libre de l'utiliser, le modifier et le distribuer, même pour faire des blagues à vos collègues.
|
|
567
|
+
|
|
568
|
+
---
|
|
569
|
+
|
|
570
|
+
## 🙏 Remerciements
|
|
571
|
+
|
|
572
|
+
- **Guido van Rossum** — Pour avoir créé Python, sans lequel Frython n'existerait pas.
|
|
573
|
+
- **La langue française** — Pour être tellement plus élégante que l'anglais (opinion non biaisée).
|
|
574
|
+
- **Les baguettes** — Pour le support moral.
|
|
575
|
+
- **Codecrafters** — Pour l'inspiration via [build-your-own-x](https://github.com/codecrafters-io/build-your-own-x).
|
|
576
|
+
|
|
577
|
+
---
|
|
578
|
+
|
|
579
|
+
<div align="center">
|
|
580
|
+
|
|
581
|
+
*Fait avec ❤️, du café ☕ et beaucoup de baguettes 🥖 en France 🇫🇷*
|
|
582
|
+
|
|
583
|
+
**⭐ Si ce projet vous a fait sourire, donnez-lui une étoile ! ⭐**
|
|
584
|
+
|
|
585
|
+
[](https://github.com/Artleboss2/frython/stargazers)
|
|
586
|
+
[](https://github.com/Artleboss2/frython/network)
|
|
587
|
+
|
|
588
|
+
</div>
|