LyangLang
A toy programming language with Romanized Nepali keywords, written in Rust. Source files use .nbh. Run with lyangpiler.
Two execution backends: tree-walking interpreter (default) and a bytecode VM (--vm). Both produce identical results.
Install
Quickest (no Rust needed):
# macOS / Linux
|
# Windows (PowerShell)
|
From crates.io (needs Rust):
Build from source:
Direct download: grab the binary for your OS from Releases.
| System | Download |
|---|---|
| Windows 64-bit | lyangpiler-windows-x86_64.zip |
| Linux 64-bit Intel/AMD | lyangpiler-linux-x86_64.tar.gz |
| Linux 64-bit ARM | lyangpiler-linux-aarch64.tar.gz |
| macOS Apple Silicon | lyangpiler-macos-aarch64.tar.gz |
| macOS Intel | lyangpiler-macos-x86_64.tar.gz |
Run a program
Legacy shorthand: lyangpiler file.nbh --vm works the same.
After install, Mac/Linux users may need source ~/.lyangpiler/enable.sh or a fresh terminal for lyangpiler to appear on PATH.
Language reference
Keywords are Romanized Nepali. Every word in a two-word keyword (like bol mug, oi mug) must be typed as-is.
)
Variables
Input
bhan reads a string from the user. To use input in arithmetic you'd need to convert it, but LyangLang doesn't have a parse/convert function yet. So bhan is for strings, and oi mug x = 5 is for numbers.
Arithmetic
All use checked arithmetic, so overflow crashes instead of wrapping silently.
)
Conditionals
yedi/yadi: if (both work, same token)babaal: equals comparisonlaamo: not-equals comparisonbhane: thenaile feri: else-ifsakiyo: end of block
String comparisons are case-insensitive in both backends ("RATO" babaal "rato" is true).
Comments
Keyword quick reference
| Syntax | Meaning | Nepali word |
|---|---|---|
bol mug |
bol = speak, mug = emphasis | |
oi mug |
declare variable | oi = exclamation, mug = emphasis |
oi mug bhan |
read input | bhan = speak/say |
mug jod |
add | jod = join/add |
mug ghata |
subtract | ghata = decrease |
mug guna |
multiply | guna = multiply |
mug bhag |
divide | bhag = share/divide |
lai |
into (target of operation) | lai = to (dative) |
yedi / yadi |
if | yedi/yadi = if |
babaal |
equals condition | (slang, repurposed) |
laamo |
not-equals condition | laamo = long (repurposed) |
bhane |
then | bhane = then |
aile feri |
else-if | aile = now, feri = again |
sakiyo |
end block | sakiyo = finished/done |
Examples
Hello World
Greet the user
Calculator
Color picker (conditionals)
Full demos in repo
Error handling
Four error types, reported to stderr with line info:
LexError: malformed tokens or unterminated stringsParseError: grammar violations (missingbhane,sakiyo, etc.)RuntimeError: overflow, division by zeroNameError: undefined variableTypeError: wrong type in arithmetic or comparison
Project structure
src/
lexer.rs source → tokens
parser.rs tokens → AST
ast.rs Statement / expression types
token.rs Token enum
interpreter.rs tree-walking backend (default)
compiler.rs AST → bytecode
bytecode.rs Opcode / Value definitions
vm.rs bytecode VM backend
error.rs error types + formatting
main.rs CLI (clap)
example.nbh feature tour
myapp/main.nbh longer interactive demo
Development
Contributing
- Fork the repo
- Create a branch:
git checkout -b feature-name - Make changes, add tests alongside
cargo build && cargo testmust stay green- Push and open a pull request
Troubleshooting
Command not found after install?
- Mac/Linux:
source ~/.lyangpiler/enable.shor open a new terminal - Windows: confirm
%USERPROFILE%\.lyangpiler\binis on your PATH
Build failures?
rustup update stablethencargo clean && cargo build
Runtime errors?
- Check for missing
sakiyoto close blocks - String comparisons: use
yedi var babaal "value"notyadi var == "value" - Arithmetic operands must be declared numbers
License
MIT