About NeLang
NeLang is an open-source programming language that maps native Nepali keywords onto a Python-powered bytecode compiler engine. It preserves Python's clean, indentation-based structure while replacing English keywords with culturally meaningful Nepali equivalents.
Core Philosophy: Programming logic is universal, but syntax should feel close to home. NeLang lowers the barrier to entry for Nepali-speaking learners and developers by making code read like their native language.
Installation
Install NeLang globally via pip. Requires Python 3.8 or higher. The installer registers a global nelang command.
pip install nelang
touch hello.nl
nelang run hello.nl
System Support
NeLang runs on all major operating systems. Requires Python 3.8+ installed as a dependency.
| Requirement | Minimum | Recommended |
|---|---|---|
| Python | 3.8 | 3.11+ |
| pip | 21.0 | Latest |
| VS Code Extension | Optional | Recommended |
Keywords Reference
All NeLang keywords map directly to Python equivalents. The table below shows each keyword, its Python counterpart, and meaning.
| NeLang | Python | Meaning | Category |
|---|---|---|---|
| karya | def | function / action | Functions |
| firta | return | return / give back | Functions |
| yadi | if | if / in case | Control Flow |
| tyasovaye | else | otherwise | Control Flow |
| jaba | while | while / as long as | Control Flow |
| lagi | for | for / iterate | Control Flow |
| vitra | in | inside / within | Control Flow |
| lekha | write / output | I/O | |
| lina | input | take / receive | I/O |
| lyaau | import | bring / fetch | Modules |
| satya | True | true / correct | Boolean |
| jhuto | False | false / wrong | Boolean |
| ra | and | and / also | Logical |
| wa | or | or / either | Logical |
| hoina | not | not / negative | Logical |
Variables & Types
Variables in NeLang are dynamically typed — no declaration keyword needed. Assign any value using =. NeLang supports integers, floats, strings, booleans, and lists.
name = "Sagarmatha"
pi = 3.14
lekha("Val:", x)
items = ["a", "b"]
done = jhuto
# This is a comment
Conditionals
Use yadi (if) and tyasovaye (else) to control execution flow. Indentation defines the block scope — no braces needed.
x = 10 yadi x > 5: lekha("Thulo") # Greater tyasovaye: lekha("Sano") # Smaller
ra (and), wa (or), and hoina (not) can be chained inside condition expressions.Loops
NeLang supports two loop constructs: jaba (while) for condition-based iteration and lagi...vitra (for...in) for traversing lists.
x = 0 jaba x < 5: lekha(x) x = x + 1
nums = [10, 20, 30] lagi n vitra nums: lekha(n)
Functions
Define reusable blocks using karya. Return values with firta. Functions support parameters and can call each other recursively.
karya multiply(a, b): firta a * b result = multiply(4, 5) lekha(result) # 20
Code Examples
Real-world programs demonstrating NeLang's capabilities from beginner to intermediate level.
Hello World
name = "Sagarmatha" lekha("Mount:", name)
List Iteration
nums = [10, 20, 30] lagi number vitra nums: lekha("Item:", number)
Function with Return
karya multiply(a, b): firta a * b result = multiply(4, 5) lekha(result)
Real-World: Circle Area with Math Module
lyaau math karya compute_circle_area(radius): yadi radius <= 0: lekha("Invalid radius") firta 0 tyasovaye: firta math.pi * math.pow(radius, 2) r = 5 lekha("Area:", compute_circle_area(r))
Interactive: Name Greeter
karya greet(): name = lina("Tapai ko naam ke ho? ") yadi name != "": lekha("Namaste,", name) tyasovaye: lekha("Yo naam ho?") greet()
CLI Commands
NeLang's CLI provides a clean interface for running scripts, inspecting version info, and debugging output.
.nl source file. Supports the --debug flag to print AST nodes and intermediate token stream.Features
lyaau to import any Python standard library module (math, random, os) directly in NeLang scripts.Roadmap
Upcoming features planned for NeLang's future releases.