A slang-infused Urdu styled programming language that turns regular code into cool slang
Try Online Playground โข Documentation โข Examples โข Actual Compiler
YaarScript is a modern, professional programming language that brings the warmth and familiarity of the Urdu language to software development. Built with Rust and compiled to WebAssembly, YaarScript offers a unique blend of cultural accessibility and cutting-edge technology.
- ๐ Urdu-Inspired Syntax โ Natural keywords like
agar,warna,dohrao,bolomake coding intuitive for Urdu speakers - โก Lightning Fast โ Entire compiler runs in the browser via WebAssembly (wasm32-unknown-unknown)
- ๐ง Industrial-Grade โ Multi-pass compiler with fixed-point optimization, constant folding, and dead code elimination
- ๐จ Modern IDE โ Professional web-based editor with syntax highlighting and real-time execution
- ๐ Strong Type System โ Strict typing with no implicit coercion for safer code
- ๐ Zero Installation โ Run directly in your browser with our online playground
YaarScript features a sophisticated multi-pass compilation pipeline:
- Lexical Analysis โ Tokenization with full Unicode support
- Syntax Analysis โ Top-Down Operator Precedence (Pratt) Parser
- Semantic Analysis โ Comprehensive scope management and type checking
- IR Generation โ Three-Address Code (TAC) intermediate representation
- Optimization โ Fixed-point optimization passes
- Execution โ High-performance WASM virtual machine
- โ
Strong Type System โ
number,float,double,char,lafz(string),faisla(boolean) - โ
Control Flow โ
agar/warna(if/else),dohrao(for),jabtak(while),karo-jabtak(do-while) - โ
Switch Statements โ
intekhabwithagar_hocases - โ Functions โ First-class functions with return types
- โ
Enumerations โ
qismfor defining custom enums - โ
Constants โ
pakkafor immutable values,sab_ke_liyefor globals - โ Operators โ Full arithmetic, logical, and comparison operations
- โ
Loop Control โ
bas_kar(break),aagay_baro(continue)
Before you begin, ensure you have the following installed:
- Node.js (v18 or higher) โ Download
- Rust (for building compiler) โ Install via rustup
- wasm-pack (for WebAssembly compilation) โ
cargo install wasm-pack
# Clone the compiler repository (wasm-compiler branch)
git clone -b wasm-compiler https://github.com/YourUsername/YaarScript-Compiler.git
cd YaarScript-Compiler
# Build the WASM package
wasm-pack build --target web
# This generates a 'pkg' folder with the compiled WASM files# Clone the web client repository
git clone https://github.com/BazilSuhail/YaarScript-Client.git
cd YaarScript-Client
# Copy the compiled WASM package
# Copy the 'pkg' folder from the compiler to the client root directory
# Install dependencies
npm install
# Run the development server
npm run devOpen http://localhost:3000 in your browser to see the application.
YaarScript-Client/
โโโ pkg/ # WASM compiled files (from compiler)
โ โโโ compiler.js
โ โโโ compiler_bg.wasm
โ โโโ ...
โโโ app/
โ โโโ page.jsx # Home page
โ โโโ editor/ # Online code editor
โ โโโ docs/ # Documentation pages
โโโ components/
โ โโโ home-page/ # Landing page components
โ โโโ editor/ # Editor components
โ โโโ docs/ # Documentation components
โโโ public/ # Static assets
โโโ package.json
yaar {
bolo("Assalam-o-Alaikum, World!\n");
}
yaar {
number age = 25;
float price = 99.99;
lafz name = "Ahmed";
faisla is_valid = sahi;
bolo("Name: ", name, "\n");
bolo("Age: ", age, "\n");
}
yaar {
number score = 85;
agar (score >= 90) {
bolo("Grade: A\n");
} warna agar (score >= 80) {
bolo("Grade: B\n");
} warna agar (score >= 70) {
bolo("Grade: C\n");
} warna {
bolo("Grade: F\n");
}
}
yaar {
dohrao (number i = 0; i < 5; i++) {
bolo("Iteration: ", i, "\n");
}
}
number add(number a, number b) {
wapsi a + b;
}
khaali greet(lafz name) {
bolo("Hello, ", name, "!\n");
}
yaar {
number sum = add(10, 20);
bolo("Sum: ", sum, "\n");
greet("YaarScript");
}
yaar {
number day = 3;
intekhab (day) {
agar_ho 1:
bolo("Monday\n");
bas_kar;
agar_ho 2:
bolo("Tuesday\n");
bas_kar;
agar_ho 3:
bolo("Wednesday\n");
bas_kar;
aakhir:
bolo("Other day\n");
}
}
| Type | Description | Example |
|---|---|---|
number |
Integer values | 42 |
float |
Single precision | 3.14 |
double |
Double precision | 2.718281828 |
char |
Single character | 'A' |
lafz |
String values | "Hello" |
faisla |
Boolean | sahi, galat |
khaali |
Void/Empty | Function return type |
| Keyword | English Equivalent | Usage |
|---|---|---|
yaar |
main | Main function entry point |
bolo |
Output to console | |
agar |
if | Conditional statement |
warna |
else | Alternative branch |
dohrao |
for | For loop |
jabtak |
while | While loop |
karo |
do | Do-while loop |
intekhab |
switch | Switch statement |
agar_ho |
case | Case in switch |
aakhir |
default | Default case |
wapsi |
return | Return from function |
bas_kar |
break | Break loop/switch |
aagay_baro |
continue | Continue loop |
pakka |
const | Constant declaration |
sab_ke_liye |
global | Global scope |
qism |
enum | Enumeration |
sahi |
true | Boolean true |
galat |
false | Boolean false |
Arithmetic: +, -, *, /, %
Comparison: ==, !=, >, <, >=, <=
Logical: &&, ||, !
Increment/Decrement: ++, --
Visit our Online Editor to start coding immediately without any installation. The playground features:
- ๐จ Syntax Highlighting โ Clean, readable code editor
- โก Instant Compilation โ Real-time compilation and execution
- ๐บ Live Terminal โ See output as you code
- ๐พ Auto-Save โ Your code is saved automatically
- ๐ Dark Theme โ Easy on the eyes
# Start development server
npm run dev
# Build for production
npm run build
# Start production server
npm start
# Lint code
npm run lint- Frontend: Next.js 16.1, React 19.2, Tailwind CSS 4
- Animations: Framer Motion
- Backend Compiler: Rust (compiled to WASM)
- Icons: React Icons
- Code Editor: Custom implementation
We welcome contributions from the community! Here's how you can help:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- ๐ Bug fixes and improvements
- ๐ Documentation enhancements
- ๐จ UI/UX improvements
- ๐ Translations and localization
- โจ New language features
- ๐งช Test coverage
- Array and list data structures
- String manipulation functions
- File I/O operations
- Standard library expansion
- Module system
- Package manager
- Debugging tools
- Mobile app version
- VS Code extension
This project is open source and available under the MIT License.
- Built with โค๏ธ for the Urdu-speaking developer community
- Powered by Rust and WebAssembly
- UI framework by Next.js and React
- Special thanks to all contributors and supporters
- Website: YaarScript Official
- GitHub Issues: Report a bug
- Discussions: Join the conversation
Made with โค๏ธ by the YaarScript Team
โญ Star this repo if you find it helpful! โญ