Compare commits
9 Commits
5adfbbfe12
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| cc8c8d9f7b | |||
| 5443c67499 | |||
| 9db5af9e07 | |||
| 16a16d9ba7 | |||
| 6adedad265 | |||
| 2aa4c05c2d | |||
| 2265e9f5ee | |||
| b075faf2e2 | |||
| e34a08a5ba |
123
README.md
123
README.md
@@ -1,54 +1,33 @@
|
|||||||
<!-- =========================================================
|
# foreignthon-te
|
||||||
FOREIGNTHON LANGUAGE PACK README TEMPLATE
|
|
||||||
---------------------------------------------------------
|
|
||||||
Replace every line marked ← REPLACE with real content.
|
|
||||||
Remove all comment blocks before publishing.
|
|
||||||
========================================================= -->
|
|
||||||
|
|
||||||
# foreignthon-xx <!-- ← REPLACE xx with your language code, e.g. foreignthon-fr -->
|
Telugu language pack for [ForeignThon](https://foreignthon.keshavanand.net/) — write Python in తెలుగు.
|
||||||
|
|
||||||
<!-- ← 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-xx
|
pip install foreignthon foreignthon-te
|
||||||
```
|
```
|
||||||
|
|
||||||
<!-- ← REPLACE xx in the line above -->
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Example
|
## Example
|
||||||
|
|
||||||
<!-- =========================================================
|
**`fizzbuzz.te.py`**
|
||||||
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
|
```python
|
||||||
<!-- ← REPLACE this block with a real .xx.py file in your language -->
|
ప్రతి i లోపల పరిధి(1, 21):
|
||||||
pour i dans intervalle(1, 21):
|
ఒకవేళ i % 15 == 0:
|
||||||
si i % 15 == 0:
|
చూపు("FizzBuzz")
|
||||||
afficher("FizzBuzz")
|
లేకపోతే_ఒకవేళ i % 3 == 0:
|
||||||
sinonsi i % 3 == 0:
|
చూపు("Fizz")
|
||||||
afficher("Fizz")
|
లేకపోతే_ఒకవేళ i % 5 == 0:
|
||||||
sinonsi i % 5 == 0:
|
చూపు("Buzz")
|
||||||
afficher("Buzz")
|
లేనిపక్షంలో:
|
||||||
sinon:
|
చూపు(i)
|
||||||
afficher(i)
|
|
||||||
```
|
```
|
||||||
|
|
||||||
<!-- ← REPLACE the block above. Run fpy compile fizzbuzz.xx.py to get the output below -->
|
|
||||||
|
|
||||||
Compiles to standard Python:
|
Compiles to standard Python:
|
||||||
|
|
||||||
```python
|
```python
|
||||||
@@ -66,91 +45,71 @@ for i in range(1, 21):
|
|||||||
Run it directly without compiling first:
|
Run it directly without compiling first:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
fpy run fizzbuzz.xx.py
|
fpy run fizzbuzz.te.py
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Keyword reference
|
## Keyword reference
|
||||||
|
|
||||||
<!-- =========================================================
|
| Python | తెలుగు |
|
||||||
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 --> |
|
| `if` | `ఒకవేళ` |
|
||||||
| `else` | <!-- ← your word --> |
|
| `else` | `లేనిపక్షంలో` |
|
||||||
| `elif` | <!-- ← your word --> |
|
| `elif` | `లేకపోతే_ఒకవేళ` |
|
||||||
| `for` | <!-- ← your word --> |
|
| `for` | `ప్రతి` |
|
||||||
| `while` | <!-- ← your word --> |
|
| `while` | `ఎంతవరకు` |
|
||||||
| `def` | <!-- ← your word --> |
|
| `def` | `రూపొందించు` |
|
||||||
| `class` | <!-- ← your word --> |
|
| `class` | `మాదిరి` |
|
||||||
| `return` | <!-- ← your word --> |
|
| `return` | `ఇవ్వు` |
|
||||||
| `import` | <!-- ← your word --> |
|
| `import` | `చేర్చు` |
|
||||||
| `True` | <!-- ← your word --> |
|
| `True` | `అవును` |
|
||||||
| `False` | <!-- ← your word --> |
|
| `False` | `కాదు_విలువ` |
|
||||||
| `None` | <!-- ← your word --> |
|
| `None` | `శూన్యం` |
|
||||||
| `print` | <!-- ← your word --> |
|
| `print` | `చూపు` |
|
||||||
| `input` | <!-- ← your word --> |
|
| `input` | `అడుగు` |
|
||||||
| `len` | <!-- ← your word --> |
|
| `len` | `పొడవు` |
|
||||||
| `range` | <!-- ← your word --> |
|
| `range` | `పరిధి` |
|
||||||
|
|
||||||
The full mapping is in [`xx.json`](https://git.keshavanand.net/foreign-thon/foreignthon-xx/raw/branch/main/src/foreignthon_xx/xx.json).
|
The full mapping is in [`te.json`](https://git.keshavanand.net/foreign-thon/foreignthon-te/raw/branch/main/src/foreignthon_te/te.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
|
## Postfix syntax
|
||||||
|
|
||||||
<!-- ← REPLACE the example below with one from your language -->
|
|
||||||
This pack supports the `@@` postfix operator for natural SOV word order.
|
This pack supports the `@@` postfix operator for natural SOV word order.
|
||||||
Instead of writing the keyword first:
|
Instead of writing the keyword first:
|
||||||
|
|
||||||
```python
|
```python
|
||||||
ஆனால் x > 0:
|
ఒకవేళ x > 0:
|
||||||
பதிப்பி(x)
|
చూపు(x)
|
||||||
```
|
```
|
||||||
|
|
||||||
You can write it in natural Tamil order — condition first, keyword after:
|
You can write it in natural Telugu order — condition first, keyword after:
|
||||||
|
|
||||||
```python
|
```python
|
||||||
x > 0 @@ஆனால்:
|
x > 0 @@ఒకవేళ:
|
||||||
பதிப்பி(x)
|
చూపు(x)
|
||||||
```
|
```
|
||||||
|
|
||||||
Both compile to the same Python. Decompile with postfix output using:
|
Both compile to the same Python. Decompile with postfix output using:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
fpy decompile script.py --lang xx --postfix
|
fpy decompile script.py --lang te --postfix
|
||||||
```
|
```
|
||||||
|
|
||||||
See [Postfix Syntax](https://foreignthon.keshavanand.net/postfix-syntax/) for full details.
|
See [Postfix Syntax](https://foreignthon.keshavanand.net/postfix-syntax/) for full details.
|
||||||
|
|
||||||
<!-- END POSTFIX SECTION -->
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Start a project
|
## Start a project
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
fpy new myproject --lang xx
|
fpy new myproject --lang te
|
||||||
cd myproject
|
cd myproject
|
||||||
fpy run src/main.xx.py
|
fpy run src/main.te.py
|
||||||
```
|
```
|
||||||
|
|
||||||
<!-- ← REPLACE xx above -->
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Documentation
|
## Documentation
|
||||||
@@ -167,4 +126,4 @@ Found a missing translation or a better keyword for your language? Open an issue
|
|||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
GPL v3
|
GPL v3
|
||||||
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "foreignthon-te"
|
name = "foreignthon-te"
|
||||||
version = "0.1.0"
|
version = "0.1.1"
|
||||||
description = "Telugu language pack for ForeignThon."
|
description = "Telugu language pack for ForeignThon."
|
||||||
license = { text = "GPL v3" }
|
license = { text = "GPL v3" }
|
||||||
requires-python = ">=3.9"
|
requires-python = ">=3.9"
|
||||||
@@ -24,7 +24,7 @@ classifiers = [
|
|||||||
Homepage = "https://git.keshavanand.net/foreign-thon/foreignthon-te"
|
Homepage = "https://git.keshavanand.net/foreign-thon/foreignthon-te"
|
||||||
|
|
||||||
[project.entry-points."foreignthon.langs"]
|
[project.entry-points."foreignthon.langs"]
|
||||||
template = "foreignthon_te"
|
te = "foreignthon_te"
|
||||||
|
|
||||||
[tool.hatch.build.targets.wheel]
|
[tool.hatch.build.targets.wheel]
|
||||||
packages = ["src/foreignthon_te"]
|
packages = ["src/foreignthon_te"]
|
||||||
@@ -26,4 +26,4 @@ except PackageNotFoundError:
|
|||||||
|
|
||||||
def get_pack_path():
|
def get_pack_path():
|
||||||
# TODO: Modify this path
|
# TODO: Modify this path
|
||||||
return files(__name__) / "template.json"
|
return files(__name__) / "te.json"
|
||||||
147
src/foreignthon_te/te.json
Normal file
147
src/foreignthon_te/te.json
Normal file
@@ -0,0 +1,147 @@
|
|||||||
|
{
|
||||||
|
"meta": {
|
||||||
|
"name": "Telugu",
|
||||||
|
"native_name": "తెలుగు",
|
||||||
|
"code": "te"
|
||||||
|
},
|
||||||
|
|
||||||
|
"keywords": {
|
||||||
|
"ఒకవేళ": "if",
|
||||||
|
"లేనిపక్షంలో": "else",
|
||||||
|
"లేకపోతే_ఒకవేళ": "elif",
|
||||||
|
"ప్రతి": "for",
|
||||||
|
"ఎంతవరకు": "while",
|
||||||
|
"రూపొందించు": "def",
|
||||||
|
"మాదిరి": "class",
|
||||||
|
"ఇవ్వు": "return",
|
||||||
|
"విరమించు": "break",
|
||||||
|
"ముందుకెళ్లు": "continue",
|
||||||
|
"ఖాళీగా_ఉంచు": "pass",
|
||||||
|
"యత్నించు": "try",
|
||||||
|
"పొరపాటు": "except",
|
||||||
|
"ముగింపుగా": "finally",
|
||||||
|
"ఎగరేయి": "raise",
|
||||||
|
"వాడుతూ": "with",
|
||||||
|
"చేర్చు": "import",
|
||||||
|
"నుంచీ": "from",
|
||||||
|
"పేరుతో": "as",
|
||||||
|
"లోపల": "in",
|
||||||
|
"అదే": "is",
|
||||||
|
"మరియు": "and",
|
||||||
|
"లేదంటే": "or",
|
||||||
|
"కాదు": "not",
|
||||||
|
"తొలగించు": "del",
|
||||||
|
"సర్వత్ర": "global",
|
||||||
|
"బయటస్థ": "nonlocal",
|
||||||
|
"నిర్ధారించు": "assert",
|
||||||
|
"ఉత్పత్తిచేయి": "yield",
|
||||||
|
"వేచిచూడు": "await",
|
||||||
|
"అసమకాల": "async",
|
||||||
|
"సూక్ష్మక్రియ": "lambda",
|
||||||
|
"అవును": "True",
|
||||||
|
"కాదు_విలువ": "False",
|
||||||
|
"శూన్యం": "None"
|
||||||
|
},
|
||||||
|
|
||||||
|
"builtins": {
|
||||||
|
"చూపు": "print",
|
||||||
|
"అడుగు": "input",
|
||||||
|
"పొడవు": "len",
|
||||||
|
"పరిధి": "range",
|
||||||
|
"రకం": "type",
|
||||||
|
"పూర్తిసంఖ్య": "int",
|
||||||
|
"దశాంశం": "float",
|
||||||
|
"వాక్యం": "str",
|
||||||
|
"జాబితా": "list",
|
||||||
|
"నిఘంటువు": "dict",
|
||||||
|
"సమితి": "set",
|
||||||
|
"జత": "tuple",
|
||||||
|
"తార్కికం": "bool",
|
||||||
|
"తెరువు": "open",
|
||||||
|
"క్రమసంఖ్యతో": "enumerate",
|
||||||
|
"మార్పు": "map",
|
||||||
|
"వడపోసు": "filter",
|
||||||
|
"క్రమబద్ధం": "sorted",
|
||||||
|
"మొత్తం": "sum",
|
||||||
|
"అత్యల్పం": "min",
|
||||||
|
"అత్యధికం": "max",
|
||||||
|
"పరమ": "abs",
|
||||||
|
"గుండ్రపరచు": "round",
|
||||||
|
"అన్నీ": "all",
|
||||||
|
"ఏదైనా": "any",
|
||||||
|
"తదుపరి": "next",
|
||||||
|
"గుర్తింపు": "id",
|
||||||
|
"అక్షరం": "chr",
|
||||||
|
"తిరగమారు": "reversed"
|
||||||
|
},
|
||||||
|
|
||||||
|
"exceptions": {
|
||||||
|
"మినహాయింపు": "Exception",
|
||||||
|
"మూలమినహాయింపు": "BaseException",
|
||||||
|
"విలువలోపం": "ValueError",
|
||||||
|
"రకంలోపం": "TypeError",
|
||||||
|
"కీలకలోపం": "KeyError",
|
||||||
|
"స్థానలోపం": "IndexError",
|
||||||
|
"లక్షణలోపం": "AttributeError",
|
||||||
|
"పేరులోపం": "NameError",
|
||||||
|
"చేర్పులోపం": "ImportError",
|
||||||
|
"దస్త్రంలేదు": "FileNotFoundError",
|
||||||
|
"నిర్వహణలోపం": "RuntimeError",
|
||||||
|
"సున్నాతోభాగహారం": "ZeroDivisionError",
|
||||||
|
"వ్యాకరణలోపం": "SyntaxError",
|
||||||
|
"నిర్ధారణలోపం": "AssertionError",
|
||||||
|
"జ్ఞాపకలోపం": "MemoryError",
|
||||||
|
"మితిమీరినవిలువ": "OverflowError",
|
||||||
|
"పునరావృతిమితి": "RecursionError",
|
||||||
|
"అనుమతిలేదు": "PermissionError",
|
||||||
|
"సమయముగిసింది": "TimeoutError",
|
||||||
|
"వ్యవస్థనిష్క్రమణ": "SystemExit",
|
||||||
|
"కీబోర్డు_అంతరాయం": "KeyboardInterrupt"
|
||||||
|
},
|
||||||
|
|
||||||
|
"error_messages": {
|
||||||
|
"SyntaxError": "వ్యాకరణ లోపం",
|
||||||
|
"ValueError": "విలువ లోపం",
|
||||||
|
"TypeError": "రకం లోపం",
|
||||||
|
"KeyError": "కీ లోపం",
|
||||||
|
"IndexError": "సూచిక లోపం",
|
||||||
|
"AttributeError": "లక్షణ లోపం",
|
||||||
|
"NameError": "పేరు లోపం",
|
||||||
|
"ImportError": "దిగుమతి లోపం",
|
||||||
|
"FileNotFoundError": "దస్త్రం కనబడలేదు",
|
||||||
|
"ZeroDivisionError": "సున్నాతో భాగహారం లోపం",
|
||||||
|
"RecursionError": "పునరావృతి పరిమితి లోపం",
|
||||||
|
"RuntimeError": "నిర్వహణ లోపం",
|
||||||
|
"MemoryError": "జ్ఞాపక లోపం",
|
||||||
|
"OverflowError": "మితిమీరిన విలువ లోపం",
|
||||||
|
"AssertionError": "నిర్ధారణ లోపం",
|
||||||
|
"PermissionError": "అనుమతి నిరాకరించబడింది",
|
||||||
|
"TimeoutError": "సమయం ముగిసింది",
|
||||||
|
"KeyboardInterrupt": "కీబోర్డు అంతరాయం"
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
"stdlib": {
|
||||||
|
"గణితం": "math",
|
||||||
|
"వ్యవస్థ": "sys",
|
||||||
|
"తేదీసమయం": "datetime",
|
||||||
|
"సమయం": "time",
|
||||||
|
"యాదృచ్ఛికం": "random",
|
||||||
|
"సేకరణలు": "collections",
|
||||||
|
"మార్గాలు": "pathlib",
|
||||||
|
"నమూనాలు": "re"
|
||||||
|
},
|
||||||
|
|
||||||
|
"postfix_keywords": [
|
||||||
|
"for",
|
||||||
|
"while",
|
||||||
|
"def",
|
||||||
|
"class",
|
||||||
|
"return",
|
||||||
|
"try",
|
||||||
|
"raise",
|
||||||
|
"with",
|
||||||
|
"import",
|
||||||
|
"from"
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -1,132 +0,0 @@
|
|||||||
{
|
|
||||||
"meta": {
|
|
||||||
"name": "Template",
|
|
||||||
"native_name": "Template",
|
|
||||||
"code": "template"
|
|
||||||
},
|
|
||||||
"keywords": {
|
|
||||||
"if": "if",
|
|
||||||
"else": "else",
|
|
||||||
"elif": "elif",
|
|
||||||
"for": "for",
|
|
||||||
"while": "while",
|
|
||||||
"def": "def",
|
|
||||||
"class": "class",
|
|
||||||
"return": "return",
|
|
||||||
"break": "break",
|
|
||||||
"continue": "continue",
|
|
||||||
"pass": "pass",
|
|
||||||
"try": "try",
|
|
||||||
"except": "except",
|
|
||||||
"finally": "finally",
|
|
||||||
"raise": "raise",
|
|
||||||
"with": "with",
|
|
||||||
"import": "import",
|
|
||||||
"from": "from",
|
|
||||||
"as": "as",
|
|
||||||
"in": "in",
|
|
||||||
"is": "is",
|
|
||||||
"and": "and",
|
|
||||||
"or": "or",
|
|
||||||
"not": "not",
|
|
||||||
"del": "del",
|
|
||||||
"global": "global",
|
|
||||||
"nonlocal": "nonlocal",
|
|
||||||
"assert": "assert",
|
|
||||||
"yield": "yield",
|
|
||||||
"await": "await",
|
|
||||||
"async": "async",
|
|
||||||
"lambda": "lambda",
|
|
||||||
"True": "True",
|
|
||||||
"False": "False",
|
|
||||||
"None": "None"
|
|
||||||
},
|
|
||||||
"builtins": {
|
|
||||||
"print": "print",
|
|
||||||
"input": "input",
|
|
||||||
"len": "len",
|
|
||||||
"range": "range",
|
|
||||||
"type": "type",
|
|
||||||
"int": "int",
|
|
||||||
"float": "float",
|
|
||||||
"str": "str",
|
|
||||||
"list": "list",
|
|
||||||
"dict": "dict",
|
|
||||||
"set": "set",
|
|
||||||
"tuple": "tuple",
|
|
||||||
"bool": "bool",
|
|
||||||
"open": "open",
|
|
||||||
"enumerate": "enumerate",
|
|
||||||
"map": "map",
|
|
||||||
"filter": "filter",
|
|
||||||
"sorted": "sorted",
|
|
||||||
"sum": "sum",
|
|
||||||
"min": "min",
|
|
||||||
"max": "max",
|
|
||||||
"abs": "abs",
|
|
||||||
"round": "round",
|
|
||||||
"all": "all",
|
|
||||||
"any": "any",
|
|
||||||
"next": "next",
|
|
||||||
"id": "id",
|
|
||||||
"chr": "chr",
|
|
||||||
"reversed": "reversed"
|
|
||||||
},
|
|
||||||
"exceptions": {
|
|
||||||
"Exception": "Exception",
|
|
||||||
"BaseException": "BaseException",
|
|
||||||
"ValueError": "ValueError",
|
|
||||||
"TypeError": "TypeError",
|
|
||||||
"KeyError": "KeyError",
|
|
||||||
"IndexError": "IndexError",
|
|
||||||
"AttributeError": "AttributeError",
|
|
||||||
"NameError": "NameError",
|
|
||||||
"ImportError": "ImportError",
|
|
||||||
"FileNotFoundError": "FileNotFoundError",
|
|
||||||
"RuntimeError": "RuntimeError",
|
|
||||||
"ZeroDivisionError": "ZeroDivisionError",
|
|
||||||
"SyntaxError": "SyntaxError",
|
|
||||||
"AssertionError": "AssertionError",
|
|
||||||
"MemoryError": "MemoryError",
|
|
||||||
"OverflowError": "OverflowError",
|
|
||||||
"RecursionError": "RecursionError",
|
|
||||||
"PermissionError": "PermissionError",
|
|
||||||
"TimeoutError": "TimeoutError",
|
|
||||||
"SystemExit": "SystemExit",
|
|
||||||
"KeyboardInterrupt": "KeyboardInterrupt"
|
|
||||||
},
|
|
||||||
"error_messages": {
|
|
||||||
"SyntaxError": "SyntaxError",
|
|
||||||
"ValueError": "ValueError",
|
|
||||||
"TypeError": "TypeError",
|
|
||||||
"KeyError": "KeyError",
|
|
||||||
"IndexError": "IndexError",
|
|
||||||
"AttributeError": "AttributeError",
|
|
||||||
"NameError": "NameError",
|
|
||||||
"ImportError": "ImportError",
|
|
||||||
"FileNotFoundError": "FileNotFoundError",
|
|
||||||
"ZeroDivisionError": "ZeroDivisionError",
|
|
||||||
"RecursionError": "RecursionError",
|
|
||||||
"RuntimeError": "RuntimeError",
|
|
||||||
"MemoryError": "MemoryError",
|
|
||||||
"OverflowError": "OverflowError",
|
|
||||||
"AssertionError": "AssertionError",
|
|
||||||
"PermissionError": "PermissionError",
|
|
||||||
"TimeoutError": "TimeoutError",
|
|
||||||
"KeyboardInterrupt": "KeyboardInterrupt"
|
|
||||||
},
|
|
||||||
"stdlib": {
|
|
||||||
"math": "math",
|
|
||||||
"sys": "sys",
|
|
||||||
"datetime": "datetime",
|
|
||||||
"time": "time",
|
|
||||||
"random": "random",
|
|
||||||
"collections": "collections",
|
|
||||||
"pathlib": "pathlib",
|
|
||||||
"re": "re"
|
|
||||||
},
|
|
||||||
|
|
||||||
"postfix_keywords": [
|
|
||||||
|
|
||||||
]
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user