Skip to content

Commit 7cf3667

Browse files
committed
عدد کی سہولت
1 parent 2556a86 commit 7cf3667

5 files changed

Lines changed: 39 additions & 25 deletions

File tree

README.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
Write simple Python in Urdu.
33

44
## How to Use
5-
1. Write Urdu code in ```سامپل۔پے```
5+
1. Create a new file in a folder.
6+
2. Write some Urdu code in the above file.
67
The mappings are as following:
78
```
89
"۔": ".",
@@ -46,12 +47,19 @@ The mappings are as following:
4647
"کوئ": "any",
4748
"ندارد": "None",
4849
```
50+
Don't worry if you can't find a mapping, you can also use English Python!
51+
3. Open a Terminal in the folder of this file.
52+
4. Run the code in one command: ```python urdu_python__ply.py <NAME_OF_YOUR_FILE>```
4953

50-
2. Translate and run the code in one command: ```python urdu_python.py```
54+
For more help, run ```python urdu_python__ply.py --help```. For better understanding, do run the sample code files in the "samples" folder.
5155

5256
## Guide
5357
### For macOS
5458
Use TextEdit (default text editor) to write Urdu code. Activate right-to-left typing through Menu: Format->Text->Writing Direction->Right-to-Left
5559

5660
### For Linux/Windows
57-
Download and install Notepad++. Right click and activate RTL (Right-to-left).
61+
Download and install Notepad++. Right click and activate RTL (Right-to-left).
62+
63+
## Tests
64+
### Platform(s) tested on
65+
macOS Big Sur 11.1

compiled.en.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
chyzyN = ["ا", "ب", "پ"]
1+
کچھ= 2
22

3-
for chyz in chyzyN:
4-
print(chyz)
3+
if کچھ == 1:‬
4+
print("سلام")‬
5+
else:‬
6+
print("دنیا")‬
57

6-
hndsh = 0
7-
8-
while hndsh != 10:
9-
print("تکرار #", hndsh)
10-
hndsh+= 1
8+
ہندسہ = 120
9+
print(ہندسہ - int("۱۰۰۰"))‬

samples/مشروط۔پای

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
کچھ = ۱
1+
کچھ= ۲
22

33
اگر کچھ == ۱:
44
چھاپ("سلام")
55
ورنہ:
6-
چھاپ("دنیا")
6+
چھاپ("دنیا")
7+
8+
ہندسہ = ۱۲۰
9+
چھاپ(ہندسہ - عدد("1000"))

test.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
def my_func():
22
print ("lol")
33

4+
from unidecode import unidecode
45

5-
6+
print ("unidecode('1000') ->", unidecode("1000"))
7+
print ("unidecode('abcd') ->", unidecode("abcd"))
8+
print ("unidecode('א') ->", unidecode("א"))
69

710
print ("type(my_func) ->", type(my_func))
811
print ("callable(my_func) ->", callable(my_func))

urdu_python__ply.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -146,16 +146,16 @@ def t_NUMBER(t):
146146

147147

148148
reserved = {
149-
"۱": "1",
150-
"۲": "2",
151-
"۳": "3",
152-
"۴": "4",
153-
"۵": "5",
154-
"۶": "6",
155-
"۷": "7",
156-
"۸": "8",
157-
"۹": "9",
158-
"۰": "0",
149+
# "۱": "1",
150+
# "۲": "2",
151+
# "۳": "3",
152+
# "۴": "4",
153+
# "۵": "5",
154+
# "۶": "6",
155+
# "۷": "7",
156+
# "۸": "8",
157+
# "۹": "9",
158+
# "۰": "0",
159159
"چھاپ": "print",
160160
"ورنہ اگر": "elif",
161161
"اگر": "if",
@@ -183,7 +183,8 @@ def t_NUMBER(t):
183183
"یا": "or",
184184
"سب": "all",
185185
"کوئ": "any",
186-
"ندارد": "None",
186+
"ندارد": "None",
187+
"عدد": "int",
187188
}
188189

189190

0 commit comments

Comments
 (0)