Amma is an educational programming language written in Malayalam, designed primarily as a learning tool for understanding compiler and interpreter design. Despite being created for educational purposes, Amma offers a complete programming experience even like recursion, file-handling, string operations etc with Malayalam keywords, making programming more accessible to Malayalam speakers.
Note
I created this project for me to learn about compilers, lexers, and related concepts. This is a personal educational project to help me understand how programming languages work under the hood.
Amma is implemented in Rust, showcasing principles of lexical analysis, parsing, and interpretation. A key feature of Amma is its support for both Malayalam script and Latin transliteration - you can write code using English characters that will be automatically converted to Malayalam keywords. This makes the language accessible even to those who cannot type in Malayalam directly.
Pre-built binaries for Windows and Linux are available in the GitHub Releases section. Simply:
- Download the appropriate binary for your platform
- Make it executable (on Linux:
chmod +x amma) // ignore this for windows - Create your Amma script with
.ammafile extension or try one from samples i have provided - Run your script ( for linux in terminal ):
./amma your_script.amma
- Run your script ( for windows cmd ):
.\amma your_script.amma
If you prefer to build from source, ensure you have the Rust compiler installed on your system:
- Clone the Amma repository
- Build the project using Cargo:
cargo build --release
- The compiled binary will be available in the
target/releasedirectory
Amma language used .amma file extension , which means the program file should have .amma extension ,ex : hello.amma
Amma supports the following data types:
- Numbers: Integers are the primary number type
- Strings: Text enclosed in single or double quotes
- Boolean: Represented as 1 (true) and 0 (false)
Variable assignment is straightforward:
name = "Aaron"
age = 19
Amma provides standard arithmetic and logical operations:
- Addition:
+ - Subtraction:
- - Multiplication:
* - Division:
/(integer division) - Modulo:
% - Comparison:
==,!=,<,>,<=,>= - Logical:
&&(AND),||(OR)
ഇത് condition സത്യമോ {
// code to execute if true
} അല്ലെങ്കില് {
// code to execute if false
}
Transliterated version (automatically converted to Malayalam):
ithu condition sathyamo {
// code to execute if true
} allenkil {
// code to execute if false
}
For Loop:
start മുതൽ end വരെ {
// code to execute
// Use _ variable for current iteration
}
Transliterated:
start muthal end vare {
// code to execute
// Use _ variable for current iteration
}
While Loop:
ഈ condition സത്യമാവണവരെ {
// code to execute
}
Transliterated:
ee condition sathyamaavanavare {
// code to execute
}
Function definition and calls:
നിശ്ചയിക്കുക function_name(parameter1, parameter2) {
// function body
മറുപടി result
}
Transliterated:
nischayikkuka function_name(parameter1, parameter2) {
// function body
marupadi result
}
Amma provides simple file operations:
Reading:
content = വായിക്കുക("filename.txt")
Writing:
എഴുതുക(content, "filename.txt")
Appending:
കൂട്ടിച്ചേർക്കുക(content, "filename.txt")
String Concatenation:
full_name = first_name + " " + last_name
String Length:
x= നീളം("hello")
String Indexing:
first_char = name[0]
Substring:
part = name.മുറിക്കുക(0, 5)
Multiplication:
x= "*" * 10
// This is a single-line comment
/* This is a
multi-line comment */
Printing to console:
പറയുക "Hello, World!"
പറയുക variable_name
Taking user input:
സ്വീകരിക്കുക variable_name
A standout feature of Amma is its transliteration system. You can write code in three ways:
- Direct Malayalam: Using Malayalam script if you have a Malayalam keyboard
- English Transliteration: Using romanized equivalents that will be automatically converted to Malayalam at run type
For example, the print statement can be written in any of these forms:
പറയുക "Hello, World!" // Direct Malayalam
parayuka "Hello, World!" // English transliteration
All keywords will be automatically converted to Malayalam during processing, making the language accessible to everyone regardless of keyboard capabilities or typing preferences.
| Write This (English) | Gets Converted To (Malayalam) |
|---|---|
| parayuka | പറയുക |
| sweekarikkuka | സ്വീകരിക്കുക |
| muthal | മുതൽ |
| vare | വരെ |
| ithu | ഇത് |
| sathyamo | സത്യമോ |
| etc...... |
പറയുക "Hello, World!"
Or with transliteration:
parayuka "Hello, World!"
parayuka "Simple Calculator"
sweekarikkuka num1
sweekarikkuka num2
parayuka "Sum: " + (num1 + num2)
parayuka "Difference: " + (num1 - num2)
parayuka "Product: " + (num1 * num2)
ithu num2 != 0 sathyamo {
parayuka "Division: " + (num1 / num2)
} allenkil {
parayuka "Cannot divide by zero"
}
നിശ്ചയിക്കുക fib(n) {
ഇത് (n == 0) സത്യമോ {
മറുപടി(0)
} അല്ലെങ്കില് {
ഇത് (n == 1) സത്യമോ{
മറുപടി(1)
} അല്ലെങ്കില് {
മറുപടി(fib(n - 1) + fib(n - 2))
}
}
}
സ്വീകരിക്കുക x
0 മുതൽ x വരെ {
പറയുക(fib(_))
}
// write
ezhuthuka("Aaron Thomas", "out.txt")
// append
കൂട്ടിച്ചേർക്കുക(" build this", "out.txt")
// read
x=vayikkuka("out.txt")
പറയുക x
| Malayalam Keyword | Transliteration | Function |
|---|---|---|
| പറയുക | parayuka | Print to console |
| സ്വീകരിക്കുക | sweekarikkuka | Accept user input |
| മുതൽ | muthal | For loop start |
| വരെ | vare | For loop end |
| ഈ | ee | While loop condition start |
| സത്യമാവണവരെ | sathyamaavanavare | While loop condition end |
| ഇത് | ithu | If statement condition |
| സത്യമോ | sathyamo | If statement condition end |
| അല്ലെങ്കില് | allenkil | Else statement |
| നിശ്ചയിക്കുക | nischayikkuka | Function definition |
| മറുപടി | marupadi | Return statement |
| വായിക്കുക | vayikkuka | Read file |
| എഴുതുക | ezhuthuka | Write file |
| കൂട്ടിച്ചേർക്കുക | kootticherkuka | Append to file |
| മുറിക്കുക | murikkuka | Substring operation |
| നീളം | neelam | string length |
Amma was created primarily as an educational tool for learning about compilers. The language demonstrates:
- Lexical Analysis: Converting source code to tokens
- Parsing: Constructing an Abstract Syntax Tree (AST)
- Interpretation: Executing the parsed AST
- Transliteration: Converting between writing systems
By studying and extending Amma, you can gain insights into language design and implementation.
Contributions to Amma are welcome! Feel free to submit issues or pull requests to help improve the language.
Made with ❤️ by arxhr007
If you find this project helpful, please consider giving it a star ⭐
This project is open source and available under the MIT License.
