सूत्रSūtra GitHub

SANSKRIT-FIRST. OPEN SOURCE.

Ancient rules.
New possibilities.

A programming language inspired by Pāṇini.
Write simple rules. Let computation unfold.

Sanskrit or Latin. The same expressive core.

THE ART OF REWRITING01 / सूत्र
A rule. A transformation. A result.
01 — define a ruleसूत्र वर्ग(?x) -> ?x * ?x।02 — apply & compose[1, 2, 3, 4, 5]
|> प्रति(वर्ग) |> समष्टि
NORMAL FORM55.
Term rewriting at the coreDevanagari & Latin syntaxRust implementationMIT licensed

01 / THE LANGUAGE

Small rules.
A different way to think.

In Sūtra, programs are sets of rewrite rules. An expression runs by transforming, step by step, until no rule applies.

01

Everything is rewriting.

Functions, conditionals, and familiar operators share one computational model. Outermost reduction makes conditionals lazy; call-by-need shares repeated work.

fn square(?x) -> ?x * ?x;
02

The later rule prevails.

Start with a general rule, then add a specific exception. Sūtra resolves competing matches through paratva, inspired by Pāṇini’s grammar.

fn kind(?x) -> Other;
fn kind(a) -> Vowel;
03

More than individual terms.

Rewrite sequences with sound classes, context, anchors, and segment captures. The standard library includes the fourteen śivasūtras and derived sound classes.

[?i:इक्, ?a:अच्]
-> [यणादेश(?i), ?a]।

TWO SCRIPTS. ONE LANGUAGE.

Your syntax.
Your starting point.

Devanagari names are canonical. Latin aliases let you explore the same language from any keyboard.

SANSKRIT / संस्कृतप्रयोग [1, 2, 3] |> प्रति((?x) => ?x * ?x) |> समष्टि।
LATIN / ASCIIeval [1, 2, 3] |> map((?x) => ?x * ?x) |> sum;

Both evaluate to 14.

02 / PLAYGROUND

A little rule goes a long way.

Edit an example. Run it. See the normal form.
The real Rust interpreter, running in your browser.

.sutra · Ctrl / ⌘ + Enter to run
OUTPUT / NORMAL FORMReady to run
Run the example to see the result.

Your code stays in this browser.

Square each number, then reduce the list to a sum. Pipes compose ordinary functions.

Pure evaluation · No installation needed

The playground evaluates expressions and eval / प्रयोग statements. Files, imports, and interactive I/O are available in the CLI.

03 / AN OPEN EXPERIMENT

Rooted in grammar.
Built for exploration.

Sūtra is a founder-led research project exploring the benefits of Sanskrit’s rich grammar as a programming model. Pāṇini’s Aṣṭādhyāyī inspires its rule-based design; the goal is a practical, general-purpose language.

Our starting point is an open-source interpreter: a concrete way to test ideas about rewriting, linguistic structure, and computation.

Follow the roadmap
IMPLEMENTED TODAY

A working foundation.

Arbitrary-precision integers, lists, maps, records, higher-order functions, guards, pure effect-as-data I/O, modules, a static checker, and a formatter.

ON THE ROADMAP

Better tools for the next step.

A language server, richer REPL editing and completion, and optional static type checking beyond the current checker.

An experimental language in active development.
Explore it, question it, help shape it.

04 / MAKE SOMETHING

Start with a rule.

Clone the repository and run Sūtra locally.
You’ll need the Rust toolchain.

Explore the repository
QUICKSTART
# Get the language
git clone https://github.com/sk-chandra/sanskrit-lang.git
cd sanskrit-lang
cargo build --release

# Evaluate your first expression
cargo run -q -- eval "sum([1, 2, 3])" --ascii
→ 6