panini-lang-0.1.1 is not a library.
ЁЯХЙя╕П Panini - Sanskrit Programming Language
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 thepanini
command.
From Crates.io (Recommended)
# Install the package
# Then use the 'panini' command
From Source
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:
ЁЯОЫя╕П CLI Commands
Interactive REPL
File Execution
Build to Binary
Web IDE Server
Help & Examples
ЁЯУЪ 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
# 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 (
рдпрджрд┐
forif
,рдЕрдиреНрдпрдерд╛
forelse
) 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.