panini-lang 0.1.1

Panini - Sanskrit programming language with Python-like syntax
panini-lang-0.1.1 is not a library.

ЁЯХЙя╕П Panini - Sanskrit Programming Language

Crates.io Documentation License: MIT

Panini is a Sanskrit programming language that combines the beauty of Devanagari script with Python-like syntax. Write code using Sanskrit keywords and execute it seamlessly!

тЬи Features

  • ЁЯОп Sanskrit Keywords: Use рджреЗрд╡рдирд╛рдЧрд░реА script for programming constructs
  • ЁЯФД Python-like Syntax: Familiar indentation-based structure
  • ЁЯЪА Multiple Interfaces: CLI, REPL, Web IDE, and file execution
  • ЁЯФз Transpilation: Convert Sanskrit code to Rust binaries
  • ЁЯМР Web IDE: Browser-based development environment with virtual keyboard
  • ЁЯУЭ Real-time Transliteration: Type English, get Sanskrit automatically

ЁЯЪА Quick Start

Installation

Note: Install with cargo install panini-lang, then use the panini command.

From Crates.io (Recommended)

# Install the package
cargo install panini-lang
# Then use the 'panini' command
panini --version

From Source

git clone https://github.com/YOUR_USERNAME/panini-lang.git
cd panini-lang
cargo install --path .

Your First Panini Program

Create hello.panini:

!! рдирдорд╕реНрддреЗ рд╡рд┐рд╢реНрд╡ - Hello World
рджрд░реНрд╢("рдирдорд╕реНрддреЗ рд╡рд┐рд╢реНрд╡")

!! рдЪрд░ рдФрд░ рдЧрдгрдирд╛ - Variables and Math
x = 5
y = 10
рдпреЛрдЧ = x + y
рджрд░реНрд╢("рдпреЛрдЧ:", рдпреЛрдЧ)

!! рд╢рд░реНрдд - Conditionals
рдпрджрд┐ x < y:
    рджрд░реНрд╢("x рдЫреЛрдЯрд╛ рд╣реИ")
рдЕрдиреНрдпрдерд╛:
    рджрд░реНрд╢("x рдмрдбрд╝рд╛ рд╣реИ")

Run it:

panini run hello.panini

ЁЯОЫя╕П CLI Commands

Interactive REPL

panini              # Start REPL (default)
panini repl         # Explicit REPL command

File Execution

panini run file.panini           # Execute Sanskrit source file
panini run file.panini --verbose # Show execution details

Build to Binary

panini build file.panini                    # Transpile and build
panini build file.panini -o myapp          # Custom output name
panini build file.panini --release         # Optimized build

Web IDE Server

panini serve                    # Start on port 8080
panini serve --port 3000       # Custom port

Help & Examples

panini --help                  # Show all commands
panini example                 # Display example code

ЁЯУЪ Language Reference

Sanskrit Keywords

Sanskrit English Description
рджрд░реНрд╢() darsh() Print/Display
рдпрджрд┐ yadi If condition
рдЕрдиреНрдпрдерд╛ anyatha Else
рдпрд╛рд╡рддреН yavat While loop
рдкрд░рд┐рднреНрд░рдордг paribhraman For loop
рдкрд░рд┐рдзрд┐() paridhi() Range function
рдХрд╛рд░реНрдп karya Function definition
!! !! Comments

Basic Syntax

Variables

рдирд╛рдо = "рднрд╛рд░рдд"
рд╕рдВрдЦреНрдпрд╛ = 42
рд╕рддреНрдп = true

Functions

рдХрд╛рд░реНрдп greet(рдирд╛рдо):
    рджрд░реНрд╢("рдирдорд╕реНрддреЗ", рдирд╛рдо)

greet("рд╡рд┐рд╢реНрд╡")

Conditionals

рдпрджрд┐ рд╕рдВрдЦреНрдпрд╛ > 0:
    рджрд░реНрд╢("рдзрдирд╛рддреНрдордХ")
рдЕрдиреНрдпрдерд╛:
    рджрд░реНрд╢("рдЛрдгрд╛рддреНрдордХ")

Loops

!! While Loop
count = 0
рдпрд╛рд╡рддреН count < 5:
    рджрд░реНрд╢(count)
    count = count + 1

!! For Loop  
рдкрд░рд┐рднреНрд░рдордг i in рдкрд░рд┐рдзрд┐(5):
    рджрд░реНрд╢("Iteration:", i)

ЁЯМР Web IDE

The web IDE provides a complete development environment:

Features

  • ЁЯО╣ Virtual Keyboard: English QWERTY + Sanskrit Devanagari layouts
  • ЁЯФД Real-time Transliteration: Type English тЖТ Get Sanskrit
  • ЁЯОп Key Highlighting: Visual feedback while typing
  • ЁЯУЦ Tutor Mode: Live ENтЖТSA conversion log
  • ЁЯкЯ Floating Interface: Draggable and resizable keyboard

Access

panini serve
# Open http://localhost:8080

ЁЯУЦ Examples

Calculator

!! рдЧрдгрдХ - Calculator
рдХрд╛рд░реНрдп add(a, b):
    return a + b

x = 15
y = 25
рджрд░реНрд╢("рдпреЛрдЧ:", add(x, y))

Fibonacci Sequence

!! рдлрд┐рдмреЛрдирд╛рдЪреА рд╢реНрд░реГрдВрдЦрд▓рд╛
рдХрд╛рд░реНрдп fibonacci(n):
    рдпрджрд┐ n <= 1:
        return n
    рдЕрдиреНрдпрдерд╛:
        return fibonacci(n-1) + fibonacci(n-2)

рдкрд░рд┐рднреНрд░рдордг i in рдкрд░рд┐рдзрд┐(10):
    рджрд░реНрд╢(fibonacci(i))

ЁЯУД License

This project is licensed under the MIT License.


рдирдорд╕реНрддреЗ! Start coding in Sanskrit today! ЁЯХЙя╕П

Run (Windows PowerShell)

# Build and run the web IDE
cargo run
# Expected output:
# Panini IDE running at http://localhost:8080
# Open http://localhost:8080 in your browser

CLI File Execution

# Run a file and print results to stdout
cargo run -- path\to\program.panini

Language Basics

!! рдЯрд┐рдкреНрдкрдгреА: рдореВрд▓ рдЙрджрд╛рд╣рд░рдгрдореН (Python-рд░реВрдкреЗрдг)
x = 5
рджрд░реНрд╢(x)
# -> 5

рдирд╛рдо = "рд╡рд┐рд╢реНрд╡"
рджрд░реНрд╢("рдирдорд╕реНрддреЗ " + рдирд╛рдо)

рдпрджрд┐ x == 5:
	рджрд░реНрд╢("рд╕рддреНрдпрдВ")
рдЕрдиреНрдпрдерд╛:
	рджрд░реНрд╢("рдЕрд╕рддреНрдпрдВ")

рдпрд╛рд╡рддреН x < 8:
	рджрд░реНрд╢(x)
	x = x + 1

рдкрд░рд┐рднреНрд░рдордг i in рдкрд░рд┐рдзрд┐(3):
	рджрд░реНрд╢(i)

рдХрд╛рд░реНрдп greet(рдирд╛рдо):
	рджрд░реНрд╢("рдирдорд╕реНрддреЗ " + рдирд╛рдо)
greet("рднрд╛рд░рдд")

Extending Panini

  • Add Sanskrit keywords (рдпрджрд┐ for if, рдЕрдиреНрдпрдерд╛ for else) to the interpreter.
  • Expand the glossary for richer translations.
  • Implement arithmetic with numbers.
  • Improve parsing (currently minimal quoting rules).

Build Release

cargo build --release
# Binary: target\release\panini(.exe)

Notes

  • This is a teaching/demo project. Not a full language.
  • The glossary is small and case-insensitive on English inputs.