Skip to content

sdpa/telang

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

తెనుగు (Telugu) Programming Language

A functional programming language with Telugu syntax

Overview

తెనుగు (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

Installation

From Source

# Clone the repository
cd <repository_path>

# The language is ready to use!
# No dependencies needed beyond Python 3.10+

Running Programs

# 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

Quick Start

Hello World

ముద్రించు("నమస్కారం, ప్రపంచం!")

Factorial Function

ఫంక్షన్ క్రమగుణకం(సంఖ్య) {
  ఒకవేళ (సంఖ్య <= 1) {
    1 ఇచ్చేయి
  } లేకపోతే {
    సంఖ్య * క్రమగుణకం(సంఖ్య - 1) ఇచ్చేయి
  }
}

ముద్రించు(క్రమగుణకం(5))  // Output: 120

Language Features

Keywords (Telugu → English)

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 Print output
ఇదిగో let/variable Variable binding
మరియు and Logical AND
లేదా or Logical OR
కాదు not Logical NOT

Data Types

  • Numbers: 123, 45.67
  • Strings: "నమస్కారం"
  • Booleans: సత్యం (true), అసత్యం (false)
  • Lists: [1, 2, 3]

Operators

  • Arithmetic: +, -, *, /, %
  • Comparison: ==, !=, <, >, <=, >=
  • Logical: మరియు (and), లేదా (or), కాదు (not)

Functions

// Define a function
ఫంక్షన్ గరిష్ఠం(a, b) {
  ఒకవేళ (a > b) {
    a ఇచ్చేయి
  } లేకపోతే {
    b ఇచ్చేయి
  }
}

// Call the function
ఇదిగో result = గరిష్ఠం(10, 20)
ముద్రించు(result)  // Output: 20

Recursion

Recursion is the primary way to achieve repetition:

ఫంక్షన్ ఫిబొనాచీ(n) {
  ఒకవేళ (n <= 1) {
    n ఇచ్చేయి
  } లేకపోతే {
    ఫిబొనాచీ(n - 1) + ఫిబొనాచీ(n - 2) ఇచ్చేయి
  }
}

Examples

See the examples/ directory for more programs:

  • hello.tg - Hello World
  • factorial.tg - Factorial using recursion
  • fibonacci.tg - Fibonacci sequence
  • arithmetic.tg - Arithmetic operations
  • higher_order.tg - Higher-order functions
  • conditionals.tg - Conditional logic

REPL

Start the interactive REPL:

python3 -m src.cli repl

Example REPL session:

తెనుగు REPL v0.1.0
నిర్గమించడానికి 'exit' లేదా Ctrl+D టైప్ చేయండి

>>> 2 + 3
5
>>> ఇదిగో x = 10
>>> x * 2
20
>>> ఫంక్షన్ రెట్టింపు(n) { n * 2 ఇచ్చేయి }
>>> రెట్టింపు(5)
10
>>> exit
వీడ్కోలు!

File Extension

Telugu programs use the .tg extension (short for "Telugu").

Comments

Single-line comments start with //:

// This is a comment
ముద్రించు("Hello")  // This is also a comment

Implementation

తెనుగు 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

Project Structure

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

Contributing

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)

License

MIT License

నమస్కారం! Happy coding in Telugu! 🎉

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages