marathilipi
v1.0.1
Published
Write TypeScript using Marathi (Devanagari) keywords — transpiled and executed via the official TypeScript compiler.
Downloads
31
Maintainers
Readme
MarathiLipi 🏆
MarathiLipi is a lightweight language layer that enables developers to write JavaScript and TypeScript using Marathi (Devanagari) syntax.
It transpiles MarathiLipi code into valid TypeScript, which is then compiled to JavaScript and executed using Node.js.
Overview
MarathiLipi does not replace JavaScript or TypeScript.
It builds on top of them.
MarathiLipi → TypeScript → JavaScript → Runtime (Node.js)Introduction
MarathiLipi lets developers write code in Marathi. A small transpiler converts Marathi keywords to valid TypeScript, which is then compiled and run using the official TypeScript compiler API — no custom parser needed.
MarathiLipi (.ml)
↓
Transpiler ← keyword replacement (src/core/dictionary.ts)
↓
TypeScript Code
↓
TypeScript Compiler (ts.transpileModule)
↓
JavaScript
↓
Node.js RuntimeInstallation
npm install -g marathilipiDevelopment (from source)
git clone https://github.com/Yuyutsu/marathilipi.git
cd marathilipi
npm install
npm run build
npm linkCLI Usage
marathilipi hello.ml
marathilipi run hello.ml
# Print generated TypeScript before execution
marathilipi run --verbose hello.mlQuick example
नाव वय = 25
जर (वय > 18) {
दाखवा("प्रौढ")
}Syntax Examples
Each example shows MarathiLipi source on the left and the TypeScript it produces on the right.
Hello World
MarathiLipi
दाखवा("जय महाराष्ट्र")TypeScript
console.log("जय महाराष्ट्र")Variables
MarathiLipi
नाव व्यक्ती = "अमोल" // let
स्थिर नाव PI = 3.14 // const (two-word phrase)
कायम MAX = 100 // const (alias)
जुने नाव x = 0 // var (two-word phrase)TypeScript
let व्यक्ती = "अमोल"
const PI = 3.14
const MAX = 100
var x = 0If / Else
MarathiLipi
नाव वय = 25
जर (वय > 18) {
दाखवा("प्रौढ")
} नाहीतर {
दाखवा("लहान")
}TypeScript
let वय = 25
if (वय > 18) {
console.log("प्रौढ")
} else {
console.log("लहान")
}Switch / Case
MarathiLipi
निवडा (वय) {
प्रकरण 18:
दाखवा("अठरा")
थांब
मूळ:
दाखवा("इतर")
}TypeScript
switch (वय) {
case 18:
console.log("अठरा")
break
default:
console.log("इतर")
}Functions
MarathiLipi
काम स्वागत(व्यक्ती) {
परत "नमस्कार " + व्यक्ती
}TypeScript
function स्वागत(व्यक्ती) {
return "नमस्कार " + व्यक्ती
}Loops
MarathiLipi
पुन्हा (नाव i = 0; i < 5; i++) {
दाखवा(i)
}TypeScript
for (let i = 0; i < 5; i++) {
console.log(i)
}Async / Await
MarathiLipi
समकाल काम डेटाआणा() {
नाव परिणाम = प्रतीक्षा fetch("/api")
दाखवा(परिणाम)
}TypeScript
async function डेटाआणा() {
let परिणाम = await fetch("/api")
console.log(परिणाम)
}Classes
MarathiLipi
प्रकार प्राणी {
निर्माता(व्यक्ती) {
हा.व्यक्ती = व्यक्ती
}
}TypeScript
class प्राणी {
constructor(व्यक्ती) {
this.व्यक्ती = व्यक्ती
}
}Error Handling
MarathiLipi
प्रयत्न {
दाखवा("धोकादायक कोड")
} पकडा (अडचण) {
चूक(अडचण.message)
} शेवटी {
दाखवा("शेवट")
}TypeScript
try {
console.log("धोकादायक कोड")
} catch (अडचण) {
console.error(अडचण.message)
} finally {
console.log("शेवट")
}Imports / Exports
MarathiLipi
आणा { add } पासून "./utils"
द्या काम greet() {}
मूळ द्या काम main() {}TypeScript
import { add } from "./utils"
export function greet() {}
export default function main() {}TypeScript Types
MarathiLipi
अंतरफलक IUser {
वय: number
}
प्रकारघोषणा ID = string | numberTypeScript
interface IUser {
वय: number
}
type ID = string | numberHow MarathiLipi Works
- CLI (
src/cli/cli.ts) parses command-line arguments and delegates to the Runner. - Runner (
src/core/runner.ts) reads the.mlfile, calls the Transpiler, and then usests.transpileModule()to compile TypeScript to JavaScript which is executed in a sandboxed VM context. - Transpiler (
src/core/transpiler.ts) iterates over the keyword list in sort order (multi-word phrases first, then by length) and replaces each Marathi keyword with its TypeScript equivalent using word-boundary-aware regular expressions. - Dictionary (
src/core/dictionary.ts) is the single source of truth for all translations. Each entry groups one or more Marathi aliases that map to the same TypeScript keyword, together with a description and optional Latin-script shorthands for VS Code autocomplete. - Keyword Map (
src/core/keywordMap.ts) is derived automatically from the dictionary and re-exports the same flatRecord<string, string>used by the runner and existing tooling.
Keyword Reference
Multi-word phrases (e.g. स्थिर नाव) are matched as complete phrases before their component words.
Rows with / list aliases that all map to the same TypeScript keyword.
| MarathiLipi | TypeScript | |------------------------------|------------------| | नाव | let | | स्थिर नाव / कायम | const | | जुने नाव | var | | जर | if | | नाहीतर | else | | निवडा | switch | | प्रकरण | case | | मूळ | default | | पुन्हा | for | | जोपर्यंत | while | | करा | do | | थांब | break | | पुढे | continue | | काम | function | | परत | return | | वेढा | yield | | समकाल / असिन्क्रॉन | async | | प्रतीक्षा | await | | प्रकार | class | | वाढवा | extends | | नवीन | new | | हा | this | | पालक | super | | निर्माता | constructor | | आणा | import | | पासून | from | | द्या | export | | मूळ द्या | export default | | प्रयत्न | try | | पकडा | catch | | शेवटी | finally | | फेका | throw | | दाखवा / सांगा / सांग / छापा | console.log | | चूक | console.error | | सूचना | console.warn | | माहिती | console.info | | हटवा | delete | | मध्ये | in | | उदाहरण | instanceof | | प्रकारघोषणा | type | | अंतरफलक | interface | | नामविश्व | namespace | | जाहीर | declare | | अमूर्त | abstract | | सार्वजनिक | public | | खाजगी | private | | संरक्षित | protected | | स्थिरसदस्य | static | | फक्तवाचा | readonly | | की | keyof | | अनुमान | infer | | संतोष | satisfies |
How to Add New Keywords
- Open
src/core/dictionary.ts. - Add a new entry (or add an alias to an existing entry's
patternsarray):{ patterns: ["मराठी_शब्द"], // one or more Marathi aliases replace: "tsKeyword", // TypeScript equivalent description: "Short description", romanizedPrefixes: ["roman"], // optional: Latin-script autocomplete hints }, - Rebuild:
npm run build.
That's it — keywordMap.ts derives itself from the dictionary automatically,
and the VS Code extension picks up the new entry from the same source.
Project Structure
marathilipi/
├── src/
│ ├── cli/
│ │ └── cli.ts # CLI entry point
│ ├── core/
│ │ ├── dictionary.ts # ← single source of truth (structured keyword entries)
│ │ ├── keywordMap.ts # flat map derived from dictionary.ts
│ │ ├── transpiler.ts # Marathi → TypeScript conversion
│ │ ├── runner.ts # orchestrates read → transpile → compile → run
│ │ └── types.ts # shared type definitions
│ ├── utils/
│ │ └── fileUtils.ts # file I/O helpers
│ └── index.ts # public library API
├── examples/
│ ├── hello.ml # hello world example
│ └── age_check.ml # if/else example
├── tests/
│ ├── transpiler.test.ts # transpiler unit tests
│ └── dictionary.test.ts # dictionary structure & ordering tests
├── vscode-extension/
│ └── src/
│ └── extension.ts # autocomplete, hover, diagnostics
├── package.json
├── tsconfig.json
└── README.mdRunning Tests
npm testMarathiLipi Playground
A fully interactive browser playground — no installation needed.
Running the playground locally
# Clone the repository (if you haven't already)
git clone https://github.com/Yuyutsu/marathilipi.git
cd marathilipi
# Open the playground in your browser
open playground/index.html # macOS
xdg-open playground/index.html # Linux
start playground/index.html # WindowsThe playground loads Monaco Editor (VS Code) from CDN, so an internet connection is required on first open. Everything else runs entirely in the browser — no build step, no server.
Features
| Feature | Detail |
|---------|--------|
| Monaco Editor | VS Code editor with full keyboard support |
| Syntax highlighting | Custom marathilipi language with keyword colouring |
| Run | Click Run or press Ctrl+Enter |
| Console output | दाखवा / console.log output appears in the right panel |
| Error display | Runtime errors shown in red in the console |
| Copy output | Copy all console lines to clipboard |
| Resizable panes | Drag the divider to adjust editor / console widths |
Example
Write this in the editor:
नाव व्यक्ती = "अमोल"
दाखवा("जय महाराष्ट्र")
जर (व्यक्ती) {
दाखवा("नमस्कार " + व्यक्ती)
}Press Run — the console shows:
जय महाराष्ट्र
नमस्कार अमोलVS Code Extension
Install the MarathiLipi Language Support extension for full syntax highlighting directly in VS Code.
Install from VSIX
cd vscode-extension
npm install
npm run package # builds marathilipi-language-0.1.0.vsix
code --install-extension marathilipi-language-0.1.0.vsixLoad unpacked (development)
- Open the
vscode-extension/folder in VS Code. - Press F5 — a new Extension Development Host window opens.
- Open any
.mlfile to see coloured Marathi keywords.
Features
| Feature | Detail |
|---------|--------|
| Syntax highlighting | All MarathiLipi keywords, strings, numbers, comments |
| Language detection | Automatic for .ml files |
| Bracket matching | {} [] () |
| Auto-closing pairs | Brackets and quotes |
| Comment shortcuts | # line comments, /* */ block comments |
| Indentation | Smart indent/outdent around blocks |
| Autocomplete | Suggests full Marathi phrases while typing Devanagari |
| Romanized autocomplete | Type a Latin-script shorthand to surface the Marathi phrase (see table below) |
| Hover | Shows TypeScript equivalent and description for any keyword |
| Diagnostics | Warns about unrecognised Devanagari tokens |
Romanized Autocomplete Shorthands
Type a Latin prefix in a .ml file and the extension suggests the matching
Marathi keyword — useful when you don't have a Devanagari IME active.
| Type… | Suggests | Maps to |
|-------|----------|----------|
| sth | स्थिर नाव | const |
| kay | कायम | const |
| nav | नाव | let |
| jun | जुने नाव | var |
| dak | दाखवा | console.log |
| san | सांगा | console.log |
| jar | जर | if |
| nah | नाहीतर | else |
| kam | काम | function |
| par | परत | return |
| sam | समकाल | async |
| prat | प्रतीक्षा | await |
Roadmap
- AST-level parsing
- Marathi error messages
- English → Marathi translator
