JSPM

hindilang

1.0.4
    • ESM via JSPM
    • ES Module Entrypoint
    • Export Map
    • Keywords
    • License
    • Repository URL
    • TypeScript Types
    • README
    • Created
    • Published
    • Downloads 2
    • Score
      100M100P100Q16546F
    • License ISC

    A Hindi-inspired scripting language

    Package Exports

      This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (hindilang) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

      Readme

      hindilang: A Hindi-Inspired Programming Language 🚀

      🔗 Full Blog: Building my own Programming Language

      hindilang is a Hindi-inspired scripting language that transpiles to JavaScript, built as an academic exercise to understand compilers and programming languages.

      Features 🌟

      ✅ Print Statements – Display output using CHAPO.
      ✅ Variables & Assignment – Declare variables with MANLO.
      ✅ User Input – Take input using PUCHO.
      ✅ Arithmetic Expressions – Perform calculations with +, -, *, /.
      ✅ Conditional Statements – Use AGAR (if) with {} blocks.
      ✅ Loops – Use JABTAK (while) for iterations.
      ✅ Comments – Use # for comments.

      A Quick Taste of hindilang

      Here are some examples

      1. Variables and Printing
      MANLO x = 5;
      CHAPO x;
      
      // Output
      // 5
      1. Taking User Input
      PUCHO y;
      CHAPO y;
      
      // (If user enters 10)
      // Output is 10
      1. Conditional Statements (if)
      MANLO x = 5;
      
      AGAR (x > 3) {
          CHAPO "X bada hai!";
      }
      
      // Output
      // X bada hai
      1. Loops (while)
      MANLO x = 5;
      
      JABTAK (x < 10) {
          CHAPO x;
          MANLO x = x + 1;
      }
      
      // Output
      // 5
      // 6
      // 7
      // 8
      // 9
      // 10
      1. Comments
      # Yeh ek comment hai
      
      //(Comments are ignored during execution)

      How to Install & Run

      1. Install Globally Hindilang must be installed globally to work as a CLI tool:
      npm install -g hindilang
      1. Run your Script
      hindic myscript.hindi

      Note: Ensure that your npm global bin directory is in your system's PATH if hindic is not recognized.


      Troubleshooting: "hindic not recognized" Problem

      If after installing you see an error like:

      'hindic' is not recognized as an internal or external command

      follow these steps:

      Check your global npm bin directory: Run the following command to find where npm installs global executables:

      npm prefix -g

      Typically, on Windows, this will be something like:

      C:\Users\<YourUsername>\AppData\Roaming\npm

      Add the directory to your PATH (if it's missing):

      • Temporary fix (only for the current terminal session):
        $env:Path += ";C:\Users\<YourUsername>\AppData\Roaming\npm"
      • Permanent fix (persists across restarts): In PowerShell, run:
        [Environment]::SetEnvironmentVariable("Path", $env:Path + ";C:\Users\<YourUsername>\AppData\Roaming\npm", "User")
        Restart your terminal after making changes !

      How It Works 🔧

      Code Flow 🚀

      📌 package.json – Defines the project and dependencies.
      📌 bin/hindic – Reads .hindi files, compiles, and executes them.
      📌 Lexer – Converts source code into tokens.
      📌 Emitter – Stores and writes transpiled JavaScript.
      📌 Parser – Matches tokens to grammar and generates JavaScript output.

      Parser Characteristics

      ✔️ Top-Down Parsing – Starts from the highest-level structure (program) and drills down into finer details like expressions and numbers.
      ✔️ Recursive Descent – The parser calls itself recursively to process different statements and expressions.
      ✔️ LL(1) Parsing – Uses one token lookahead to determine the next action without backtracking.

      Beyond Transpiling

      🛣️ Use LLVM to generate optimized machine code.
      🛣️ Emit x86 assembly and compile using an assembler (nasm).
      🛣️ Convert code to WebAssembly (WASM) for execution in browsers.


      Other Info 🤝

      • Inspired by TeenyTinyCompiler
      • Feel free to open issues or submit PRs.
      • Future plans: A Playground for it to see it run in the browser.

      🚀 Made with ❤️ by Arjit Sharma