Maghilchi (programming language)

From HandWiki
Short description: Programming language


Maghilchi is an interpreted language with a natural language-like syntax with Tamil words. The name of this language is inspired by words from Kollywood actor Rajinikanth’s dialogue, Maghilchi was developed to enable K12 students studying Tamil medium-based syllabus in their schools to explore and develop programs in the Tamil language without any language barrier.

Using the Maghilchi programming language, Tamil-speaking developers can write the program as they speak the Tamil language, as this language has natural language-based syntax. Maghilchi is the first Tamil-based programming language which has natural language-based syntax and it is freely available. The language was officially announced in Aug 2022, and it has been developed since late 2020.

Goal:

Maghilchi language is targeted toward K-12 students, and native-Tamil speakers, to learn elementary computer science principle.

Features:

  • variables and operations
  • conditionals
  • loops (for each, while)
  • first-order functions
  • module imports
  • access modifiers (private, constant)
  • recursion
  • a byte code compiler to speed up module loading
  • precise stack traces for run-time exceptions
  • Math Ops (SUM, SUB, MUL, DIV, MOD)
  • Unary Ops (SUM, SUB)
  • Datatypes(Bool, String, Number)
  • Logical ops (≥, >, ≤, <, ==, !=)

Type system:

Maghilchi has 4 types number , string, array , dictionary and collections

Keywords:

Conditional statements are modelled after if else Loop control statements deriving from the WHILE statements are chosen. The function declaration syntax and recursion are kept simple. Details include the print statement, and the flow control statements below.

"அழை": CALL,
        "if": IF,
        "பிறகு": THEN,
        "else": ELSE,
        "#": COMMENT,
        "ஆக": FOR,
        "ஒவ்வொன்றும்": EACH,
        "உள்ளே": IN,
        "சரிபார்க்கப்பட்டது": CHECK,
        "சமமான": EQUAL,
        "குறைவாக": LESS,
        "அதிக": GREATER,
        "விட": THAN,

variable scoping :

Maghilchi 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.

Implementation:

Maghilchi 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.

Language - control structures, function declarations and operators grammar:

If else conditions:

பொறுத்து condition செய்ய true
if condition பிறகு {
பொறுத்து b செய்ய 3
multiply தன்னை by 2
அச்சிடு தன்னை
}
if false பிறகு {அச்சிடு 1} else {அச்சிடு 2}
if இல்லை true பிறகு {அச்சிடு 1} else {அச்சிடு 2}

Arithmetic Operator :

பொறுத்து a செய்ய 1
பொறுத்து b செய்ய 1
கூட்டு a செய்ய b
கூட்டு 1 செய்ய b
அச்சிடு b
அச்சிடு a

Example Program

அச்சிடு "*********"
அச்சிடு "********"
அச்சிடு "*******"
அச்சிடு "******"
அச்சிடு "*****"
அச்சிடு "****"
அச்சிடு "***"
அச்சிடு "**"
அச்சிடு "*"


References