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
Click to enlarge
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
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