Skip to main content

A Sanskrit-based programming language transpiler and runtime for Python

Project description

Sanskrit-Py

A Sanskrit-inspired programming language built on top of Python.

Sanskrit-Py lets you write Python-like programs using Sanskrit syntax and keywords while transpiling them into executable Python code.


Features

  • Sanskrit-inspired syntax
  • Python transpiler/compiler
  • Interactive REPL
  • Simple CLI interface
  • Educational programming language design
  • Lightweight and beginner-friendly
  • Extensible architecture

Installation

Install from PyPI:

pip install sanskrit-py

Verify installation:

sanskrit

Quick Example

Sanskrit Code

krte n antah vividham(1, 5):
    mudranam(n)

Output

1
2
3
4

REPL (Interactive Terminal)

Launch the Sanskrit interactive shell:

sanskrit

Example session:

==========================================================
   sanskrit-py Python Interactive Terminal (REPL)
                  संगणक संस्कृतम्
==========================================================

>>> mudranam("नमस्ते")
नमस्ते

Language Keywords

Sanskrit Keyword Meaning
mudranam print
krte for
yadi if
anyatha else
tavat while
varga class
kriya function

Running Sanskrit Files

Run a Sanskrit source file:

sanskrit example.sk

Development Installation

Install editable mode for development:

pip install -e .

Project Structure

sanskrit-py/
│
├── sanskrit/
│   ├── __init__.py
│   ├── cli.py
│   ├── compiler.py
│   ├── core.py
│   ├── parser.py
│   ├── repl.py
│   └── runtime.py
│
├── tests/
├── README.md
├── LICENSE
└── pyproject.toml

Requirements

  • Python 3.8+
  • pip

Example Programs

Conditional

yadi x > 10:
    mudranam("बृहत्")
anyatha:
    mudranam("लघु")

Loop

krte n antah vividham(1, 10):
    mudranam(n)

Function

kriya namaste():
    mudranam("नमस्ते")

Installation for TestPyPI

pip install --index-url https://test.pypi.org/simple/ sanskrit-py

License

Apache-2.0 License


Links


Vision

Sanskrit-Py is an experimental attempt to explore programming language design using Sanskrit grammar concepts inspired by Paninian systems and Indian linguistic traditions.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sanskrit_py-1.0.2.tar.gz (8.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sanskrit_py-1.0.2-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

Details for the file sanskrit_py-1.0.2.tar.gz.

File metadata

  • Download URL: sanskrit_py-1.0.2.tar.gz
  • Upload date:
  • Size: 8.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.0

File hashes

Hashes for sanskrit_py-1.0.2.tar.gz
Algorithm Hash digest
SHA256 8b15477fb5767d375c4eda875bf7abfa895865cf639c6c030f0d629afa4ac70f
MD5 8328902bbf7167bfbd887dee7cc41ad6
BLAKE2b-256 9e64971d2322ebfa0b66196757ccf470d845ad37caa0b3f329e1e9c14f531cd2

See more details on using hashes here.

File details

Details for the file sanskrit_py-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: sanskrit_py-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 8.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.0

File hashes

Hashes for sanskrit_py-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 6950fe3ed02fe90a64b4cbba120a81ffa7913fd811312bc14588ac3ad2a5e8f5
MD5 d2b71bcf1995ea0bade6e5acdfda44d2
BLAKE2b-256 7e26806376f1258a41231fe32692cfeaf444b17bb04727064459cd66d124491a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page