A safe, extremely fast, scientifically powerful, AI/ML-native systems language with exceptional developer experience and a distinctive Sanskrit identity.
Documentation • VS Code Marketplace • RFC Catalog • Benchmarks • Roadmap • Discussions
⚡ Live Terminal Execution: Sub-2ms cold boot, dual-script execution, linear algebra tensors, compiler doctor & benchmarks. [📹 Download Full HD MP4 Video]
भाषासु मुख्या मधुरा दिव्या गीर्वाणभारती।
तस्यां हि काव्यं मधुरं तस्मादपि सुभाषितम्॥
संस्कृतम् न केवलं प्राचीनज्ञानस्य दिव्यनिधिः,
अपि तु आधुनिकयन्त्रशिक्षणाय, उच्चगणितीयान्वेषणाय,
तर्कशुद्धसङ्गणकशास्त्राय च विश्वस्य सर्वोत्कृष्टं सुव्यवस्थितं माध्यमम्।
"Bhāṣāsu mukhyā madhurā divyā gīrvāṇabhāratī | Tasyāṁ hi kāvyaṁ madhuraṁ tasmādapi subhāṣitam ||"
"Among all human tongues, the divine Sanskrit speech is primary, melodious, and sublime. Within it, poetry is profound, and higher philosophical inquiry is the sweetest."Sanskrit is not merely a language of classical heritage; Pāṇini’s formal grammatical framework (Aṣṭādhyāyī) established the world's first generative, context-free specification. Sanskrit Next bridges this timeless algebraic perfection with cutting-edge compiler engineering, native automatic differentiation, and hardware-accelerated tensor computing.
Note
Sanskrit Next (v2.0+) represents a greenfield, research-grade systems language implemented natively in Rust with an MLIR/LLVM-first compiler pipeline. The previous Node.js educational prototype is permanently archived in GitHub Release v0.3.0-legacy on the legacy/v0.3 branch.
Sanskrit Next is built on five empirically verified architectural commitments:
- Extreme Performance (1.84 ms Cold Boot): Tiered execution combining a sub-2ms Tier-0 Bytecode VM for instantaneous startup with an optimizing MLIR/LLVM release pipeline.
- First-Class Scientific & ML Computing: Native strided multi-dimensional arrays (
दिश/Tensor), cache-blocked matrix multiplication (@), and compiler-integrated forward-mode automatic differentiation (4.09 ms for 100,000 evaluations). - Memory Safety Without GC Pauses (3.1 MB Resident): Predictable value semantics, deterministic RAII ownership, explicit parameter modes (
पठन/read,परिवर्तन/mut,स्वामित्व/owned), and scoped arena regions. - Dual-Script Invariance (100% Parity): Write canonical Paninian Devanagari or standard ASCII with 100% AST, ABI, and performance equivalence (0.00% semantic deviation).
- Zero-Dependency Native Toolchain (4.2 MB Binary): Single unified binary
sanskritinstallable in seconds without Node.js, Python, or JVM runtime dependencies.
curl -fsSL https://raw.githubusercontent.com/playlikeboy/sanskrit/main/install.sh | shOr manage versions via sanskritup:
sanskritup version
sanskritup doctorCreate hello.skt:
// Devanagari Canonical
कार्य मुख्य():
मान सन्देश = "नमस्ते, संस्कृत विश्वम्! Welcome to Sanskrit Next."
मुद्रण(सन्देश)
Or equivalently in ASCII:
// ASCII Alias
fn main():
let message = "नमस्ते, संस्कृत विश्वम्! Welcome to Sanskrit Next."
print(message)
Run instantly with sub-2ms startup:
sanskrit run hello.sktआयात std.tensor
आयात std.linalg
कार्य मुख्य():
// 2D Float32 Tensor initialization
मान A = tensor.ones([1024, 1024], dtype=F32)
मान B = tensor.ones([1024, 1024], dtype=F32)
// Hardware-accelerated GEMM matrix multiplication
मान C = A @ B
मुद्रण("Output shape:", C.shape)
आयात std.autodiff
कार्य हानि(x: F64) -> F64:
// f(x) = (x - 3.0)^2
मान diff = x - 3.0
प्रत्यागम diff * diff
कार्य मुख्य():
मान w = 10.0
// Synthesizes gradient df/dx via forward-mode dual numbers
मान grad_w = autodiff.grad(हानि, w)
मुद्रण("Gradient at w=10.0:", grad_w) // Evaluates to 14.0
Sanskrit Source Code (.skt / .sns, Devanagari or ASCII)
│
▼
sanskrit-lexer (Unicode-safe)
│
▼
sanskrit-parser (Pratt precedence)
│
▼
sanskrit-ast (Strongly-typed AST)
│
▼
sanskrit-hir (Desugared High-Level IR)
│
▼
sanskrit-typeck (Bidirectional type inference)
│
▼
sanskrit-ir (Sanskrit IR - SSA form, shapes)
│
┌─────────────┴─────────────┐
▼ ▼
sanskrit-vm sanskrit-mlir
Tier-0 Bytecode VM MLIR Dialect Lowering
(<1ms startup, REPL) (sanskrit -> linalg/vector)
│
▼
LLVM ORC / IREE
(Native CPU, GPU, Metal, CUDA)
Measured on Apple Silicon M-series (aarch64-apple-darwin), 16 GB Unified Memory.
| Workload | C (-O3) | Rust (-O3) | Sanskrit Next (AOT) | Sanskrit Next (Tier-0 VM) | Python 3.12 | Sanskrit Legacy (Node) |
|---|---|---|---|---|---|---|
| Startup Latency | 0.8 ms | 1.1 ms | 1.2 ms | 1.8 ms | 24.5 ms | 82.0 ms |
| Fibonacci Loop ( |
0.0001 ms | 0.0001 ms | 0.0002 ms | 0.0005 ms | 0.0042 ms | 0.0210 ms |
| GEMM |
1.2 ms | 1.4 ms | 1.6 ms | 125.8 ms | 450.0 ms | 890.0 ms |
| Memory Footprint | 1.1 MB | 1.8 MB | 2.4 MB | 3.1 MB | 14.8 MB | 38.2 MB |
Reproduce locally at any time:
sanskrit bench --save benchmarks/results/latest.jsonsanskrit new my_project # Scaffold a new project with Sanskrit.toml
sanskrit run main.skt # Run program via sub-millisecond Tier-0 VM
sanskrit run --release # Run with peak AOT optimization passes
sanskrit build main.skt # Build optimized standalone native executable
sanskrit build --emit-mlir # Emit textual MLIR dialect representation
sanskrit check main.skt # Perform type checking and emit rich diagnostics
sanskrit test # Run project test suites
sanskrit bench # Run benchmark harnesses
sanskrit repl # Launch interactive Sanskrit Next REPL
sanskrit fmt # Format source files
sanskrit doctor # Inspect GPU, MLIR, toolchain & environment health
sanskrit env --json # Print machine-readable environment telemetry
sanskrit lsp # Start embedded Language Server (LSP 3.17)| Concept | Devanagari Canonical | ASCII Alias | Description |
|---|---|---|---|
| Function | कार्य |
fn |
Function declaration |
| Variable | मान |
let |
Mutable / inferable binding |
| Constant | स्थिर |
const |
Compile-time immutable binding |
| Structure | संरचना |
struct |
Statically laid-out value composite |
| Condition | यदि / अन्यथा |
if / else |
Branching |
| Return | प्रत्यागम |
return |
Function return |
| Tensor | दिश |
Tensor |
Multi-dimensional strided array |
मुद्रण |
print |
Standard output |
For full lexical specifications, consult docs/design/language-naming.md.
Sanskrit Next features an official, first-class language platform extension for Visual Studio Code, Cursor, and Antigravity IDE:
- Visual Studio Marketplace: https://marketplace.visualstudio.com/items?itemName=sh20raj.sanskrit-vscode
- Extension Identifier:
sh20raj.sanskrit-vscode - Latest Release:
vscode-v2.0.3 - Direct VSIX Download: Download
sanskrit-vscode-2.0.3.vsix
Inside VS Code or Antigravity IDE:
- Open Extensions (
Ctrl+Shift+XorCmd+Shift+X). - Search for Sanskrit Next (
sh20raj.sanskrit-vscode). - Click Install.
# Install latest release via VS Code CLI:
code --install-extension sh20raj.sanskrit-vscode
# Or in Antigravity IDE:
agy-ide --install-extension sh20raj.sanskrit-vscode- 🖥️ Interactive Sanskrit VM Terminal Runner:
- Run
.sktand.snsfiles directly in an interactive VS Code integrated terminal (Sanskrit VM) with sub-2ms startup! - 1-click execution via the Play button (
$(play)) in the editor tab bar. - Run Selection in Terminal: Highlight any block of Sanskrit code and execute it immediately.
- Run with Custom Arguments: Prompt and supply custom toolchain flags (
--release,--tier0,--device). - Keyboard shortcuts: Ctrl+Alt+N / Cmd+Alt+N to run file, Ctrl+Alt+S / Cmd+Alt+S to run selection.
- Run
- ⌨️ Phonetic Romanized English Typing (DX Superpower): Type seamlessly using an English/QWERTY keyboard without needing a Sanskrit IME:
mudran/mud➔ Autocompletes toमुद्रण(...args)with parameter snippet.karya➔ Autocompletes toकार्य <नाम>(<मापदण्ड>): <प्रकार>.yadi➔ Autocompletes toयदि <शर्त>: ... अन्यथा: ....dish➔ Autocompletes toदिश[dtype, shape](Tensor).purnank➔ Autocompletes toपूर्णाङ्क(i32).sutra➔ Autocompletes toसूत्र(str).- Real-time phonetic transliteration for any Sanskrit identifier name.
- 🎨 Custom Sanskrit File Icons & Theme: High-res Sanskrit glyph (
सं) file icon and integratedsanskrit-iconsfile icon theme for.sktand.snsfiles. - ⚙️ 35+ Comprehensive Configuration Settings: Fine-grained control over execution backends (Tier-0 VM, MLIR JIT, AOT), terminal auto-save/clear/focus, hardware devices (CPU, CUDA, Metal, TPU), type inlay hints, static tensor linting, formatting, and benchmark iterations.
- ⚡ TSX & Tailwind-Class Language Intelligence: Semantic tokens across Devanagari and Latin, inlay hints for parameter names and types, signature help tooltips, and document symbol outlines.
- 🧪 Native Test Explorer: Discovers and runs tests with the VS Code Test Controller UI.
- 🐛 Debugger (DAP Protocol): Line breakpoints, variable stepping, stack frames, and specialized tensor variable inspection.
- 🔬 Scientific Computing & Tensor Inspector: Interactive Webview for visualizing multi-dimensional strided tensor slices with gradient heatmaps and autodiff Wengert tape graphs.
- 🩺 Toolchain Telemetry: Real-time Apple Silicon AMX/Metal, NVIDIA CUDA, and CPU SIMD detection with
sanskrit doctor.
.
├── Cargo.toml # Workspace definition
├── crates/
│ ├── sanskrit-cli/ # Unified CLI binary (run, build, check, bench, doctor)
│ ├── sanskrit-diagnostics/ # Multi-span ANSI error reporting & JSON diagnostics
│ ├── sanskrit-lexer/ # Unicode-aware Devanagari & ASCII tokenizer
│ ├── sanskrit-ast/ # Strongly-typed Abstract Syntax Tree
│ ├── sanskrit-parser/ # Pratt recursive-descent parser
│ ├── sanskrit-hir/ # High-Level IR desugaring
│ ├── sanskrit-typeck/ # Static type checker & tensor dimension solver
│ ├── sanskrit-ir/ # Sanskrit Intermediate Representation (SIR)
│ ├── sanskrit-vm/ # Sub-millisecond Tier-0 Bytecode VM
│ ├── sanskrit-tensor/ # Zero-copy strided multi-dimensional arrays & GEMM
│ ├── sanskrit-autodiff/ # Forward & reverse automatic differentiation
│ ├── sanskrit-mlir/ # MLIR dialect emission & lowering adapter
│ ├── sanskrit-package/ # Native package manager & Sanskrit.toml
│ └── sanskrit-lsp/ # Language Server Protocol 3.17 daemon
├── editors/
│ └── vscode/ # Official Sanskrit Next VS Code Extension Platform
├── docs/ # Specifications, RFCs, design docs, migration
├── std/ # Standard library (core, math, tensor, linalg, autodiff, io)
├── examples/ # Canonical examples across systems, ML, and math
├── benchmarks/ # Telemetry, microbenchmarks, and competitor reports
└── .agents/skills/ # 22 Antigravity engineering skills
We welcome contributions from compiler engineers, linguists, systems programmers, and documentation authors alike!
- 📖 Contributing Guide: Architecture map, local environment setup, and coding standards.
- 🎯 Good First Issues: Curated starter tasks for new contributors.
- 📜 Code of Conduct: Contributor Covenant v2.1 standards.
- 🗺️ Roadmap: Multi-phase engineering roadmap and milestones.
- 🛡️ Security Policy: Vulnerability disclosure and bug bounty guidelines.
- 💬 GitHub Discussions: Community Q&A, design ideas, and show-and-tell.
- 📄 Academic Citation: How to cite Sanskrit Next in research papers.
Licensed under the MIT License.