-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
200 lines (181 loc) · 7.85 KB
/
index.html
File metadata and controls
200 lines (181 loc) · 7.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>TM-Lang: Tamil-Inspired Programming</title>
<script src="https://cdn.jsdelivr.net/pyodide/v0.24.1/full/pyodide.js"></script>
<link rel="stylesheet" href="style.css">
</head>
<body>
<a href="https://bhashabytes.github.io/" class="site-logo" aria-label="BhashaBytes Home">
<img src="logo.png" alt="BhashaBytes Logo" />
</a>
<h1>TM-Lang: Tamil-Inspired Programming</h1>
<div class="intro-card">
<p>
Welcome to <strong>TM-Lang</strong> – a programming language designed especially for Tamil speakers!
TM-Lang makes coding more intuitive by using Tamil words and their transliterations as keywords,
instead of English-based Python syntax. It’s beginner-friendly and runs fully on Python via a translation layer.
</p>
<p>
Write code below, run it instantly, and explore TM-Lang’s features with live examples. Learning programming
has never been this friendly!
</p>
</div>
<div class="container">
<textarea id="tamilCode" rows="10">காட்டிடு("வணக்கம் TM-Lang!")</textarea>
<br>
<button onclick="runCode()">Run Code</button>
<pre id="output">Output will appear here...</pre>
</div>
<h2>Documentation & Examples</h2>
<div class="docs">
<h3>Print (காட்டிடு / kaattidu)</h3>
<pre>காட்டிடு("வணக்கம் உலகமே")</pre>
<h3>Functions (வரையிடு / varaiyidu)</h3>
<pre>வரையிடு கூட்டு(a, b):
திருப்பிடு a + b
காட்டிடு("மொத்தம் =", கூட்டு(3, 5))</pre>
<h3>Input (எடுத்து / eduthu)</h3>
<pre>a = int(எடுத்து("எண் 1:"))
b = int(எடுத்து("எண் 2:"))
காட்டிடு("மொத்தம் =", a + b)</pre>
<h3>Conditionals</h3>
<pre>i = 5
என்றால் i > 3:
காட்டிடு("பெரியது")
இல்லை_என்றால் i == 3:
காட்டிடு("சமம்")
இல்லை:
காட்டிடு("சிறியது")</pre>
<h3>Loops</h3>
<pre>காக x in [1,2,3]:
காட்டிடு("x =", x)
i = 0
போது i < 3:
காட்டிடு("i =", i)
i += 1</pre>
<h3>Loop Control</h3>
<pre>காக x in [1,2,3]:
என்றால் x == 2:
காட்டிடு("இரண்டு கண்டுபிடிக்கப்பட்டது")
நிறுத்திடு
இல்லை:
காட்டிடு(x)</pre>
<h3>Booleans & None</h3>
<pre>என்றால் உண்மை:
காட்டிடு("true")
இல்லை_என்றால் பொய்:
காட்டிடு("false")
காட்டிடு("வெற்று =", ஒன்றுமில்லை)</pre>
<h3>Exceptions</h3>
<pre>முயற்சிடு:
1 / 0
தவிர ZeroDivisionError:
காட்டிடு("பூஜ்யத்தால் பகுக்க முடியாது")
இறுதியில்:
காட்டிடு("எப்போதும் இயங்கும்")</pre>
<h3>Imports</h3>
<pre>உள்ளிடு math ஆக m
காட்டிடு(m.sqrt(16))</pre>
</div>
<h2>TM-Lang Keywords</h2>
<div class="reference-box">
<table>
<thead>
<tr><th>Python</th><th>Tamil</th><th>Transliteration</th></tr>
</thead>
<tbody>
<tr><td>print</td><td>காட்டிடு</td><td>kaattidu</td></tr>
<tr><td>input</td><td>எடுத்து</td><td>eduthu</td></tr>
<tr><td>if</td><td>என்றால்</td><td>enraal</td></tr>
<tr><td>elif</td><td>இல்லை_என்றால்</td><td>illainraal</td></tr>
<tr><td>else</td><td>இல்லை</td><td>illai</td></tr>
<tr><td>for</td><td>காக</td><td>kaga</td></tr>
<tr><td>while</td><td>போது</td><td>pothu</td></tr>
<tr><td>def</td><td>வரையிடு</td><td>varaiyidu</td></tr>
<tr><td>class</td><td>வகுப்பு</td><td>vaguppu</td></tr>
<tr><td>return</td><td>திருப்பிடு</td><td>thiruppidu</td></tr>
<tr><td>break</td><td>நிறுத்திடு</td><td>niruthidu</td></tr>
<tr><td>continue</td><td>தொடரிடு</td><td>thodaridu</td></tr>
<tr><td>import</td><td>உள்ளிடு</td><td>ulkollu</td></tr>
<tr><td>from</td><td>இருந்து</td><td>irundhu</td></tr>
<tr><td>as</td><td>ஆக</td><td>aaga</td></tr>
<tr><td>with</td><td>உடன்</td><td>udan</td></tr>
<tr><td>try</td><td>முயற்சிடு</td><td>muyarchidu</td></tr>
<tr><td>except</td><td>தவிர</td><td>thavira</td></tr>
<tr><td>finally</td><td>இறுதியில்</td><td>iruthil</td></tr>
<tr><td>True</td><td>உண்மை</td><td>unmai</td></tr>
<tr><td>False</td><td>பொய்</td><td>poi</td></tr>
<tr><td>None</td><td>ஒன்றுமில்லை</td><td>onrumillai</td></tr>
<tr><td>or</td><td>அல்லது</td><td>allatu</td></tr>
</tbody>
</table>
</div>
<script>
let pyodideReady = false, pyodide;
async function loadPyodideAndPackages() {
pyodide = await loadPyodide();
pyodide.runPython(`
import sys
from js import document, prompt
class OutputCatcher:
def write(self, s):
if s.strip():
document.getElementById("output").textContent += s + "\\n"
def flush(self): pass
sys.stdout = OutputCatcher()
sys.stderr = OutputCatcher()
def input(msg=""):
resp = prompt(str(msg))
return "" if resp is None else str(resp)
`);
pyodideReady = true;
}
loadPyodideAndPackages();
const mapping = {
"காட்டிடு":"print","kaattidu":"print",
"எடுத்து":"input","eduthu":"input",
"என்றால்":"if","enraal":"if",
"இல்லை_என்றால்":"elif","illainraal":"elif",
"இல்லை":"else","illai":"else",
"காக":"for","kaga":"for",
"போது":"while","pothu":"while",
"வரையிடு":"def","varaiyidu":"def",
"வகுப்பு":"class","vaguppu":"class",
"திருப்பிடு":"return","thiruppidu":"return",
"நிறுத்திடு":"break","niruthidu":"break",
"தொடரிடு":"continue","thodaridu":"continue",
"உள்ளிடு":"import","ulkollu":"import",
"இருந்து":"from","irundhu":"from",
"ஆக":"as","aaga":"as",
"உடன்":"with","udan":"with",
"முயற்சிடு":"try","muyarchidu":"try",
"தவிர":"except","thavira":"except",
"இறுதியில்":"finally","iruthil":"finally",
"உண்மை":"True","unmai":"True",
"பொய்":"False","poi":"False",
"ஒன்றுமில்லை":"None","onrumillai":"None",
"அல்லது":"or","allatu":"or"
};
function escapeRegExp(str) {
return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
}
function translate(code) {
for (let tam in mapping) {
const re = new RegExp(`(?<!\\w)${escapeRegExp(tam)}(?!\\w)`, 'gu');
code = code.replace(re, mapping[tam]);
}
return code;
}
async function runCode() {
if (!pyodideReady) { alert("Loading..."); return; }
document.getElementById("output").textContent = "";
const rawCode = document.getElementById("tamilCode").value;
const pyCode = translate(rawCode);
try { await pyodide.runPythonAsync(pyCode); }
catch(err) { document.getElementById("output").textContent += "Error: "+err+"\n"; }
}
</script>
</body>
</html>