Sutra

A Sanskrit-style joke programming language

A minimal joke programming language that compiles to JavaScript. Features a CLI tool, interactive web playground, and regex-based compiler. Built with Node.js, Next.js, and Chakra UI.

Project Screenshots

Sutra - A Sanskrit-style joke programming language - Web Development Project Screenshot 1 by Tarun Jawla
Click to enlarge
Sutra - A Sanskrit-style joke programming language - Web Development Project Screenshot 2 by Tarun Jawla
Click to enlarge

About the Project

Sutra is a Sanskrit-style joke programming language inspired by Bhailang. It compiles to JavaScript using a lightweight regex-based compiler (no AST). The project includes a CLI tool published to npm, an interactive web playground built with Next.js and Chakra UI, and comprehensive documentation. Features include syntax highlighting, error handling with precise line/column reporting, and a responsive design with an ancient Indian aesthetic theme.

✨ Key Features


#

πŸ”§ Core Compiler

- Regex-based Compiler: Lightweight compiler without parser libraries or AST
- JavaScript Output: Compiles Sanskrit-style code to standard JavaScript
- Error Handling: Precise error reporting with line and column information
- Clean Codebase: Maintainable implementation (~250 lines for compiler)

#

🌐 Interactive Web Playground

- Live Code Editor: Write and execute Sutra code in the browser
- Syntax Highlighting: Enhanced code readability
- Real-time Compilation: Instant JavaScript output
- Copyable Examples: Documentation with copyable code snippets
- Responsive Design: Works seamlessly on all devices
- Ancient Indian Theme: Beautiful UI with cultural aesthetic

#

πŸ“¦ CLI Tool

- npm Package: Published as @tarunjawla/sutra
- Simple Commands: Easy-to-use CLI interface (sutra run file.skt)
- File Execution: Run Sutra files directly from command line
- Cross-platform: Works on Windows, macOS, and Linux

πŸ—οΈ Architecture


The project consists of three main components:

```
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Web Playgroundβ”‚ β”‚ CLI Tool β”‚ β”‚ Core Compiler β”‚
β”‚ (Next.js 14) β”‚ β”‚ (Node.js) β”‚ β”‚ (JavaScript) β”‚
β”‚ React 18 β”‚ β”‚ npm package β”‚ β”‚ Regex-based β”‚
β”‚ Chakra UI β”‚ β”‚ β”‚ β”‚ β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚ β”‚ β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ JavaScript Output β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
```

πŸš€ Quick Start


#

Using the CLI


1. Install the package
```bash
npm install -g @tarunjawla/sutra
```

2. Create a Sutra file (file.skt)
```sanskrit
// Your Sanskrit-style code here
```

3. Run the file
```bash
sutra run file.skt
```

#

Using the Web Playground


Visit [sutra-lang.tarunjawla.com](https://sutra-lang.tarunjawla.com/) to use the interactive playground where you can write, compile, and execute Sutra code directly in your browser.

πŸ› οΈ Tech Stack


#

Core Compiler

- Node.js: Runtime environment
- JavaScript (ES6+): Modern JavaScript features
- Regex-based Compilation: No external parser libraries

#

Website/Playground

- Next.js 14: React framework with App Router
- React 18: UI library
- Chakra UI 2.8: Component library
- Framer Motion: Animation library
- Noto Sans Devanagari: Fonts for Sanskrit aesthetic

#

CLI

- Node.js: Runtime environment
- npm: Package distribution

πŸ“¦ Project Highlights


- βœ… Built a working compiler from scratch
- βœ… Published to npm as @tarunjawla/sutra
- βœ… Deployed Next.js app to production
- βœ… Clean, maintainable codebase (~250 lines for compiler)
- βœ… Full documentation and examples
- βœ… Comprehensive error handling
- βœ… Beautiful, responsive design

Tech Stack

Frontend

Next.js 14React 18Chakra UI 2.8Framer MotionNoto Sans Devanagari

Backend

Node.jsJavaScript (ES6+)Regex-based Compilernpm CLI

Key Features

Regex-based compiler (no parser libraries)
CLI tool (sutra run file.skt)
Interactive web playground
Syntax highlighting
Error handling with line/column info
Documentation with copyable examples
Responsive design with ancient Indian theme
Published to npm as @tarunjawla/sutra

Project Links

Tarun Jawla - Full Stack Developer & Freelance Software Engineer