Skip to main content

A Sanskrit programming language — from Pāṇini to silicon.

Project description

Ādeśa (आदेश)

A Sanskrit programming language — from Pāṇini to silicon.

Ādeśa ("command") is a small interpreted language whose keywords are real Sanskrit imperatives, written in the pure-ASCII Harvard-Kyoto convention so they type on any keyboard. When you write vada you are writing वद — the loṭ lakāra imperative "Speak!" — and the machine obeys.

$ python adesha.py
Ādeśa shell (Harvard-Kyoto) — type 'samApti' to quit.
>> vada namaste lokAH
namaste lokAH
>> punaH tri vada punarukti
punarukti
punarukti
punarukti

punaH tri — "again, three times." Numbers can be Sanskrit words (eka, dvi, tri, … aSTottarazata = 108) or digits; both work everywhere.

Why Sanskrit?

Not decoration — lineage. Pāṇini's Aṣṭādhyāyī (~500 BCE) is a formal generative grammar of ~4,000 ordered rewrite rules with meta-rules and context-sensitive transformations — structurally the same device as the BNF notation that defines modern programming languages (computer scientists sometimes call it the Pāṇini–Backus form). Piṅgala's Chandaḥśāstra (~200 BCE) encoded poetic meter as sequences of light (laghu) and heavy (guru) syllables — a binary notation, two millennia early. Sanskrit is arguably the only human language that was formally specified, the way programming languages are. Ādeśa is built on that inheritance: Sanskrit structure and vocabulary — never a claim that the machine "understands" Sanskrit meaning.

The language in one screen

# lesson0_final.adesha — my first program
sthApaya nama rAma          # "establish!"  — set a variable
vada namaste nama           # "speak!"      — print (namaste rAma)

yadi nama == rAma           # "if"
    vada sAdhu              # blocks end with iti ("thus")
anyathA                     # "otherwise"
    vada anyat
iti

vidhi ghata n               # "procedure"  — define a function
    yadi n <= eka
        dehi 1              # "give!"      — return a value
    iti
    dehi n * ghata(n - 1)
iti
gaNaya ghata(paJca)         # "compute!"   — 120 (recursion works)

samUha s                    # "collection" — make a list
yojaya s Adi                # "join!"      — append
vada s[eka]                 # 1-based indexing: eka is the first element

mudrA nama                  # "seal!"      — 108-bit integrity fingerprint

Booleans are satya/asatya. Logic is ca/vA/na (and/or/not). Errors speak both languages with a numbered doSa code, a line number, and a did-you-mean:

>> vad namaste
doSa-001: ajYAta Adeza 'vad' (did you mean: vada?) — unknown command 'vad' (did you mean: vada?)

Every keyword is registered in three spellings: Harvard-Kyoto canonical (sthApaya), lowercase (sthapaya), and Devanagari (स्थापय).

Sealed scripts

adesha seal file.adesha stamps a script with its own fingerprint footer; adesha parIkSA file.adesha later answers siddha (intact, exit 0) or bhraSTa (tampered, exit 1). Like a wax seal on a letter — tamper-evident homework, lesson files, and documents.

Two layers, honestly labeled

Ādeśa is a two-layer stack:

  • adesha/ — the high-level language (this repo, fully self-contained, Python stdlib only).
  • aos_asm.py — a low-level layer whose FOLD/lane operations mirror a private RNS chip design (the A0S project). It runs here on a software model. The chip-true lane_residue() in this repo was verified against the chip's RTL by co-simulation: 1,000/1,000 randomized inputs agree bit-for-bit across the built-in mirror, the verified golden model, and the Verilog core under Icarus Verilog — see tests/reports/c2_parity_report.md. The chip design itself is not in this repo, and nothing here requires it.

Two different numbers, two different jobs: mudrA is a 108-bit software integrity fingerprint (mod M107); the chip lane residue (mod 12289) reflects Harvard-Kyoto prosodic weight and is deliberately not an integrity primitive.

Try it

git clone https://github.com/ayushbhoi08-lab/adesha.git
cd adesha
python adesha.py                       # REPL
python adesha.py examples/zloka_mudra.adesha   # seal a Bhagavad Gītā verse
python adesha.py --trace run examples/function.adesha  # watch it execute
python -m pytest tests -q              # the test suite

The browser playground (Pyodide, zero install) lives in playground/ — serve it with python -m http.server from that folder, or open it directly at https://ayushbhoi08-lab.github.io/adesha/.

New to programming? Start with Lesson Zero — five steps that teach one programming concept and one real Sanskrit grammar note at a time.

Status

Active, early, and honest about it. The language core (tokenizer, expression parser, blocks, functions with recursion, lists, dual-language errors, seal/verify CLI) is complete and tested. On the roadmap: a sandhi-based macro layer (Pāṇini's own mechanism as a language feature), an aṣṭa-dik turtle for teaching, and offline Sanskrit voice commands. This project makes no claims of natural-language understanding, translation, or NLP.

License

Apache-2.0

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

adesha-0.1.0.tar.gz (37.2 kB view details)

Uploaded Source

Built Distribution

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

adesha-0.1.0-py3-none-any.whl (26.6 kB view details)

Uploaded Python 3

File details

Details for the file adesha-0.1.0.tar.gz.

File metadata

  • Download URL: adesha-0.1.0.tar.gz
  • Upload date:
  • Size: 37.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for adesha-0.1.0.tar.gz
Algorithm Hash digest
SHA256 8934501d319b0b12f6188d1bcd49d5c779760730ff4d07118f65707288b48a03
MD5 35a8ab49ce76efd1f46e79fa4208144b
BLAKE2b-256 b15dc41f332dc8fe037efcb75b1d1b2268bfdb62f3d65bdf66ef9b5f95c8d209

See more details on using hashes here.

File details

Details for the file adesha-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: adesha-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 26.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for adesha-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d2275058f02febae38267822370c5b4dc610883c3160d37c2c1a08d3a0acf54c
MD5 8271c3589e35499c9a90f6aa3f058842
BLAKE2b-256 7ff95f0ef394b62b0ca1993f3145bd2dd8bd674c7622cd9c12cee8d4b227aebb

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