Ezhil is basically a Tamil version of Python.
As an aside, the most hilarious thing about it is that even actual Tamil people, creating actual Tamil programming language, where every other letter of the program is in Tamil script, still use ASCII numerals for numbers. So as usual, I was completely right, and Raku \d
is indeed completely broken.
Anyway, let's give Ezhil a try.
With Linguagem Potigol I could at least try to write some Portuguese. With Tamil, I'm going full Google Translate, so if I accidentally say "your mother was a hamster and your father smells of elderberries" in Tamil, blame Google Translate for that.
Vaṇakkam, ulakam!
Default package does not work, so you need to install it with pip3 install ezhil==1.0.rc0
.
#!/usr/bin/env ezhili
பதிப்பி "வணக்கம், உலகம்!"
$ ./hello.n
வணக்கம், உலகம்!
Yūṉikōṭ
Let's start by checking Unicode support:
#!/usr/bin/env ezhili
பதிப்பி தநீளம்("Hello")
பதிப்பி தநீளம்("ஆமை")
பதிப்பி தநீளம்("🍛")
$ ./unicode.n
5
2
1
As Tamil writing is syllabic, "ஆமை" is just two characters.
Fibonacci numbers:
Ḥpaipōṉacci eṇkaḷ
#!/usr/bin/env ezhili
நிரல்பாகம் ஃபைபோனச்சி (அ)
@( அ <= 2 ) ஆனால்
பின்கொடு 1
இல்லை
பின்கொடு ஃபைபோனச்சி(அ-1) + ஃபைபோனச்சி(அ-2)
முடி
முடி
@(range(1,21) இல் அ) ஒவ்வொன்றாக
பதிப்பி "ஃபைபோனச்சி(", அ, ") =", ஃபைபோனச்சி(அ)
முடி
$ ./fib.n
ஃபைபோனச்சி( 1 ) = 1
ஃபைபோனச்சி( 2 ) = 1
ஃபைபோனச்சி( 3 ) = 2
ஃபைபோனச்சி( 4 ) = 3
ஃபைபோனச்சி( 5 ) = 5
ஃபைபோனச்சி( 6 ) = 8
ஃபைபோனச்சி( 7 ) = 13
ஃபைபோனச்சி( 8 ) = 21
ஃபைபோனச்சி( 9 ) = 34
ஃபைபோனச்சி( 10 ) = 55
ஃபைபோனச்சி( 11 ) = 89
ஃபைபோனச்சி( 12 ) = 144
ஃபைபோனச்சி( 13 ) = 233
ஃபைபோனச்சி( 14 ) = 377
ஃபைபோனச்சி( 15 ) = 610
ஃபைபோனச்சி( 16 ) = 987
ஃபைபோனச்சி( 17 ) = 1597
ஃபைபோனச்சி( 18 ) = 2584
ஃபைபோனச்சி( 19 ) = 4181
ஃபைபோனச்சி( 20 ) = 6765
Step by step:
- it's Python-based but it's not just Python with keywords replaced
- in particular it doesn't have
:
equivalent and ues முடி forend
instead - hilariously Google Translate translates முடி as "hair", but that's not the intended meaning here
-
ஃபைபோனச்சி
forfib
andஅ
fora
are just some identifiers - syntax is often backwards from Python, and Ezhil uses
@
for such cases -
நிரல்பாகம் ... முடி
is a function -
@(...) ஆனால் ... இல்லை ... முடி
is an if/else -
@(...) ஒவ்வொன்றாக ... முடி
is a for each loop -
பின்கொடு
is return - somehow f-strings never got to Ezhil!
- Ezhil translates a lot of keywords and function names to Tamil, but then it sometimes just doesn't, like there's no Tamil version of
range
so it sticks out like a sore thumb
FizzBuzz
As range
is not in Tamil, let's just do a while loop:
#!/usr/bin/env ezhili
அ = 1
செய்
@( 0 == அ % 15 ) ஆனால்
பதிப்பி "FizzBuzz"
@( 0 == அ % 5 ) இல்லைஆனால்
பதிப்பி "Buzz"
@( 0 == அ % 3 ) இல்லைஆனால்
பதிப்பி "Fizz"
இல்லை
பதிப்பி அ
முடி
அ = அ + 1
முடியேனில் @(அ <= 100)
$ ./fizzbuzz.n
1
2
Fizz
4
Buzz
Fizz
7
8
Fizz
Buzz
11
Fizz
13
14
FizzBuzz
16
17
Fizz
19
Buzz
...
Step by step:
-
இல்லைஆனால்
iselse if
-
செய் ... முடியேனில் @(...)
is a do-while loop, there's no direct Python equivalent of those
Kaṭṭam
Ezhil changes how indexing works. a[b,c]
is equivalent of Python's a[b][c]
, which could be argued is more intuitive:
#!/usr/bin/env ezhili
கட்டம் = [
[10, 20, 30],
[40, 50, 60],
[70, 80, 90],
]
பதிப்பி கட்டம்[0,0]
பதிப்பி கட்டம்[1,2]
பதிப்பி கட்டம்[-1,1]
பதிப்பி கட்டம்[-1,-1]
$ ./grid.n
10
60
80
90
Uṅkaḷ peyar eṉṉa?
Let's ask user for their name and say hello.
#!/usr/bin/env ezhili
பெயர் = raw_input("உன் பெயர் என்ன? ")
பதிப்பி "வணக்கம், " + பெயர் + "!"
./name.n
$ உன் பெயர் என்ன? குமார்
வணக்கம், குமார்!
As you can see, as soon as we go outside the very basic basics we keep running into untranslated English words like raw_input
.
Should you use Ezhil?
If you're a Tamil schoolkid, maybe.
I'm not sure how much it actually helps. Linguagem Potigol was strongly committed to being 100% Portuguese (in practice a bit of English slipped through like parse errors from ANTLR), Ezhil is full of English words when you move beyond basics, and all the error messages are in English.
I'm also not sure how familiar Tamil schoolkids are with English letters. Is ஒவ்வொன்றாக
really much easier to them than for
?
Would it help if they went all in, made error messages Tamil, provided Tamil equivalent names for the whole Python standard library and so on? I'm not sure if this limited effort is worth it.
At least it let me show once and for all that Raku is wrong about \d
.
Code
All code examples for the series will be in this repository.
Top comments (0)