Ezhil (programming language)


Ezhil, in Tamil language script, is a compact, open source, interpreted, programming language, originally designed to enable native-Tamil speaking students, K-12 age-group to learn computer programming, and enable learning numeracy and computing, outside of linguistic expertise in predominately English language-based computer systems.
In the Ezhil programming language, Tamil keywords and language-grammar are chosen to easily enable the native Tamil speaker write programs in the Ezhil system. Ezhil allows easy representation of computer program closer to the Tamil language logical constructs equivalent to the conditional, branch and loop statements in modern English based programming languages. Ezhil is the first freely available programming language in the Tamil language and one of many known non-English-based programming languages. The language was officially announced in July 2009, while it has been developed since late 2007.

Description

The syntax of Ezhil is broadly similar to that of BASIC: blocks of code are run in sequential order, or via functions definitions, in a common control flow structures include while, and if. The termination of function block and statement blocks should have the termination keyword, similar to END in BASIC. Declarations are not necessary as Ezhil is a dynamic typed language, though type conversions must be made explicitly. Ezhil has built-in types for Numbers, Strings, Logicals and Lists.

Goals

Conditional Statements are modeled after the IF-ELSEIF-ELSE statement. Loop control statements deriving from the WHILE statements are chosen. The function declaration syntax is kept simple. Details include the print statement, and the flow control statements below.

1.- : PRINT statement - பதிப்பி
2.- : BREAK statement - நிறுத்து
3.- : CONTINUE statement - தொடர்
4.- : RETURN statement - பின்கொடு
5.- : IF-ELSEIF-ELSE-statement - ஆனால், இல்லைஆனால், இல்லை
6.- : END-statement - முடி
7.- : FUNCTION-statement - நிரல்பாகம்
8.- : WHILE-statement - வரை

Type system

Ezhil has four basic types, for Numbers, Strings, Logicals and Lists. It does not allow creation of new types, being a procedural language without structures or objects.

Language - control structures, function declarations and operators grammar

Standard language grammar for control structures for Ezhil language is given below,

If-else statement


@ ஆனால்
#True branch
இல்லை
#False branch
முடி

Loop statement


@ வரை
#LOOP BODY
முடி

Operators

Standard logical operators, equality "", inequality "!=", arithmetic comparison ">=", "<=",">","<" are supported. Arithmetic operators like "+","-","*","/" indicate standard plus, minus, product, division. Modulo is denoted by "%", and exponent by "^" characters.

Comments

'#' character denotes a single-line comment from the point to end-of-line. Multi-line comments are not defined.

Function declaration


நிரல்பாகம்

முடி

Variable scoping, and visibility

Ezhil supports only call-by-value, and copies all data structures on function invocations. Globals are not supported. Recursion is supported and functions invocation copies variables.

Implementations

Current Ezhil implementation is tightly integrated with the Python runtime. Ezhil interpreter is based on a readline-like CLI, while it can also be run in a batch mode. The interactive mode consumes programs as UTF-8 encoded text and builds a tree, using a compiler front-end, to build an AST, and executes it using the Python objects build from this AST.

Examples

Hello world

The following is a Hello world program in Ezhil:

  1. தமிழில் ஒரு எடுத்துக்காட்டு
பதிப்பி "வணக்கம் Vijay!"
பதிப்பி "உலகே வணக்கம்"
பதிப்பி "******* நன்றி!. *******"
exit

Guessing game

The following is a guessing game with 10-chances to guess a number between .

பதிப்பி "வணக்கம், விதி விளையாட்டுக்கு வருக!"
  1. ஒவ்வொரு முறை ஒரு புதிய விதி தேவை
seed
எண் = randint
  1. 10 வாய்ப்புகளை கொடுக்க
வாய்ப்பு = 0
@ வரை
பதிப்பி "நான் என் இதயத்தில் எண் ஒன்று நினைக்கிறேன்"
பதிப்பி "நான் என்ன நினைக்கிறேன் என்று தெரியுமா?"
guess = உள்ளீடு
வாய்ப்பு = வாய்ப்பு + 1
#பதிப்பி
#பதிப்பி எண்
@ ஆனால்
பதிப்பி "வாழ்த்துக்கள்! சரியான பதில்"
exit
முடி
@ ஆனால்
பதிப்பி "உங்கள் உள்ளீடு அதிகமாக உள்ளது"
இல்லை
பதிப்பி "உங்கள் உள்ளீடு குறைத்து உள்ளது"
முடி
பதிப்பி "இன்னும் "
பதிப்பி
பதிப்பி "வாய்ப்புக்குள் மீதமுள்ளன முடி"
முடி
பதிப்பி "மன்னிக்கவும் : 10 வாய்ப்பு முடிக்க முடியவில்லை!"
exit

File:Ezhil Guessing Game.png|thumb|right|The following is a guessing game with 10-chances to guess a number between

File I/O


  1. கோப்புப் பயன்பாடு
fp = கோப்பை_திற
  1. நாம் ஒரு பட்டியலில் இருந்து வார்த்தைகளை பயன்படுத்த முடியும்
எ =
இ = 0
@ வரை
# நாம் ஒவ்வொரு வரியும் ஒரு எண் மற்றும் வார்த்தை சேர்க்க முடியும்
வரி = str +" = "+ எடு + " \n"
பதிப்பி வரி
கோப்பை_எழுது
இ = இ + 1
முடி
  1. சேமித்து மூட
கோப்பை_மூடு
  1. மறு திறந்த கோப்பு
fp = கோப்பை_திற
  1. மற்றும் உள்ளடக்கங்களை படிக்கவும்
வரிகள் = கோப்பை_படி
  1. பயனருக்கு காண்பிக்க
பதிப்பி வரிகள்
  1. கோப்பு மூட
கோப்பை_மூடு
  1. ஒரு எடிட்டர் கோப்பு திறக்க, "names.txt". emacs அல்லது Notepad பயன்படுத்தவும்.

Turtle graphics

The following is a Turtle graphics based example to draw the Yin-Yang symbols.

நிரல்பாகம் yin
#turtle_width
turtle_color
turtle_fill
turtle_circle
turtle_circle
turtle_left
turtle_circle
turtle_color
turtle_fill
turtle_color
turtle_left
turtle_up
turtle_forward
turtle_right
turtle_down
turtle_circle
turtle_left
turtle_fill
turtle_up
turtle_backward
turtle_down
turtle_left
முடி
நிரல்பாகம் main
#turtle_reset
yin
yin
turtle_ht
pause
முடி
main

Logo Ezhil