A functional programming language with Telugu syntax
తెనుగు (Telugu) is a minimal, elegant functional programming language designed to make programming accessible in Telugu. It features:
- 🌟 Pure Telugu Syntax: All keywords and syntax in Telugu script
- 🔧 Functional-First: Immutability, first-class functions, recursion
- 📚 Educational: Simple implementation for learning compiler design
- ⚡ Fast: Python-based interpreter with minimal overhead
# Clone the repository
cd <repository_path>
# The language is ready to use!
# No dependencies needed beyond Python 3.10+# Run a program
python3 -m src.cli run examples/hello.tg
# Start the REPL
python3 -m src.cli repl
# Check syntax
python3 -m src.cli check examples/factorial.tgముద్రించు("నమస్కారం, ప్రపంచం!")
ఫంక్షన్ క్రమగుణకం(సంఖ్య) {
ఒకవేళ (సంఖ్య <= 1) {
1 ఇచ్చేయి
} లేకపోతే {
సంఖ్య * క్రమగుణకం(సంఖ్య - 1) ఇచ్చేయి
}
}
ముద్రించు(క్రమగుణకం(5)) // Output: 120
| Telugu | English | Purpose |
|---|---|---|
| ఫంక్షన్ | function | Define a function |
| ఒకవేళ | if | Conditional |
| లేదంటే | else if | Else-if branch |
| లేకపోతే | else | Else branch |
| సత్యం | true | Boolean true |
| అబద్ధం | false | Boolean false |
| ఇచ్చేయి | return | Return value |
| ముద్రించు | Print output | |
| ఇదిగో | let/variable | Variable binding |
| మరియు | and | Logical AND |
| లేదా | or | Logical OR |
| కాదు | not | Logical NOT |
- Numbers:
123,45.67 - Strings:
"నమస్కారం" - Booleans:
సత్యం(true),అసత్యం(false) - Lists:
[1, 2, 3]
- Arithmetic:
+,-,*,/,% - Comparison:
==,!=,<,>,<=,>= - Logical:
మరియు(and),లేదా(or),కాదు(not)
// Define a function
ఫంక్షన్ గరిష్ఠం(a, b) {
ఒకవేళ (a > b) {
a ఇచ్చేయి
} లేకపోతే {
b ఇచ్చేయి
}
}
// Call the function
ఇదిగో result = గరిష్ఠం(10, 20)
ముద్రించు(result) // Output: 20
Recursion is the primary way to achieve repetition:
ఫంక్షన్ ఫిబొనాచీ(n) {
ఒకవేళ (n <= 1) {
n ఇచ్చేయి
} లేకపోతే {
ఫిబొనాచీ(n - 1) + ఫిబొనాచీ(n - 2) ఇచ్చేయి
}
}
See the examples/ directory for more programs:
hello.tg- Hello Worldfactorial.tg- Factorial using recursionfibonacci.tg- Fibonacci sequencearithmetic.tg- Arithmetic operationshigher_order.tg- Higher-order functionsconditionals.tg- Conditional logic
Start the interactive REPL:
python3 -m src.cli replExample REPL session:
తెనుగు REPL v0.1.0
నిర్గమించడానికి 'exit' లేదా Ctrl+D టైప్ చేయండి
>>> 2 + 3
5
>>> ఇదిగో x = 10
>>> x * 2
20
>>> ఫంక్షన్ రెట్టింపు(n) { n * 2 ఇచ్చేయి }
>>> రెట్టింపు(5)
10
>>> exit
వీడ్కోలు!
Telugu programs use the .tg extension (short for "Telugu").
Single-line comments start with //:
// This is a comment
ముద్రించు("Hello") // This is also a comment
తెనుగు is implemented in Python 3.10+ with:
- Lexer: Tokenizes Telugu Unicode text
- Parser: Recursive descent parser builds AST
- Interpreter: Tree-walking interpreter evaluates AST
- No external dependencies: Pure Python implementation
telugu-lang/
├── src/
│ ├── lexer.py # Tokenizer
│ ├── parser.py # Parser
│ ├── ast_nodes.py # AST node definitions
│ ├── interpreter.py # Interpreter
│ └── cli.py # Command-line interface
├── examples/ # Example programs
├── tests/ # Test suite
├── docs/ # Documentation
├── README.md
└── pyproject.toml
Contributions are welcome! Areas for improvement:
- More built-in functions
- List manipulation functions (map, filter, reduce)
- Pattern matching
- Module system
- Type system
- Compiler backend (LLVM)
MIT License
నమస్కారం! Happy coding in Telugu! 🎉