Case studyLive

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.

Role
Full-stack engineer
Stack
Next.js 14 · React 18 · Chakra UI 2.8
Visit the live siteSource
A Sanskrit-style joke programming language

Overview

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       │
                    └───────────────────────────┘

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

Screens