Skip to content
happinessisrealPublic

About

আলভীলান: a Bangla programming language for kids. Bangla keywords, digits and error messages; compiles to native code via LLVM.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

5 Commits

Folders and files

Repository files navigation

Alveelan logo: অ on the red disc of the Bangladesh flag

আলভীলান · Alveelan

A Bangla programming language for kids, compiled to fast native code with LLVM.

Every keyword, type and error message is in Bangla. Write numbers with ০–৯, and your program answers in ০–৯ too.

CI Rust LLVM License: MIT

The logo reads “এটি অ নয়”, "this is not অ", after Magritte. In code, a symbol is never the thing it names. The blinking cursor is the full stop.

English · বাংলা

Terminal: a Fibonacci program written in Bangla is compiled with alveelan and prints the first ten Fibonacci numbers in Bangla digits

Why

For many young learners in Bangladesh, English keywords are an extra hurdle on top of learning to program. Alveelan removes it:

  • The whole language is in Bangla. ধরি (let), যদি/নাহলে (if/else), যতক্ষণ (while), ফাংশন (function), দেখাও (print). Types are সংখ্যা (whole number), দশমিক (decimal), লেখা (text), সত্যমিথ্যা (true/false) and তালিকা[…] (list).
  • Numbers in Bangla digits. Programs accept ১০ or 10, and printed results come back as ৩০, ১২০ and ৩.৫.
  • Friendly Bangla error messages. They give the line number and name the variable or type involved, so learners can fix mistakes on their own.
  • A real compiler. It does more than interpret: the source goes through a lexer, parser, type checker and LLVM, and comes out as a native executable.

Bangla compiler error messages for a type mismatch, an undefined variable and a syntax error with its line number

🚀 Install

Prerequisites:

  • Rust (1.85+)
  • a C compiler (cc)
  • LLVM 18, 19, 20 or 21 with development headers
# Ubuntu / Debian
sudo apt install llvm-18-dev libpolly-18-dev libzstd-dev clang

git clone https://github.com/happinessisreal/alveelan.git
cd alveelan
./install.sh          # detects your LLVM version, builds, installs to ~/.local/bin
Manual build / other LLVM versions
cargo build --release                                            # LLVM 18 (default)
cargo build --release --no-default-features --features llvm20    # or llvm19 / llvm21
sudo cp target/release/alveelan /usr/local/bin/

If the build can't find LLVM, point llvm-sys at it, e.g. export LLVM_SYS_181_PREFIX=/usr/lib/llvm-18.

✏️ Your first program

// hello.alv
ফাংশন শুরু() {
    দেখাও("হ্যালো, পৃথিবী!")
}
alveelan hello.alv     # অভিনন্দন! 'hello' তৈরি করা হয়েছে।
./hello                # হ্যালো, পৃথিবী!

🧩 A quick tour

ফাংশন ফ্যাক্টোরিয়াল(এন: সংখ্যা) -> সংখ্যা {       // a function that returns a number
    যদি (এন <= ১) {
        ফেরত ১
    } নাহলে {
        ফেরত এন * ফ্যাক্টোরিয়াল(এন - ১)        // recursion works
    }
}

ফাংশন শুরু() {
    ধরি ক: তালিকা[সংখ্যা] = [১০, ২০, ৩০]        // a list of numbers
    ক[১] = ১০০
    দেখাও(ক[১])                                  // ১০০

    ধরি ঘর: সংখ্যা = ১
    যতক্ষণ (ঘর <= ৩) {                            // while loop
        যদি (না (ঘর == ২)) {                        // skip ২
            দেখাও(ফ্যাক্টোরিয়াল(ঘর + ৪))         // ১২০, then ৫০৪০
        }
        ঘর = ঘর + ১
    }
}

The full syntax, operators, keyword table and current limitations are in docs/LANGUAGE.md.

📚 Examples

File Shows
hello.alv printing text
math.alv variables, arithmetic, যদি / নাহলে
array.alv lists of numbers and text, indexing, updating
factorial.alv functions and recursion
fibonacci.alv recursion inside a যতক্ষণ loop
multiplication_table.alv the ৫ times table (নামতা) with a loop
even_odd.alv %, এবং, অথবা, না, boolean functions
circle.alv দশমিক (decimal) arithmetic

Every example is compiled and run in CI, and its output is checked against tests/expected/.

⚙️ How it works

.alv ─▶ Lexer ─▶ Parser ─▶ Semantic analysis ─▶ LLVM IR ─▶ object file ─▶ cc + runtime ─▶ executable
Stage Where
Lexer. Bangla keywords, Unicode identifiers, ০–৯ digits normalised to 0–9 src/frontend/lexer
Parser. Recursive descent with precedence climbing, producing an AST src/frontend/parser
Semantic analysis. Scopes, type checking, function signatures, Bangla diagnostics src/frontend/semantic
Code generation. LLVM IR through inkwell, optimisation levels -O0…-O3 src/backend/codegen
Runtime. A tiny C library that prints numbers with Bangla digits runtime/alv_runtime.c
alveelan program.alv -o program   # output name
alveelan program.alv -O 2         # optimise
alveelan program.alv --emit-ir    # inspect the generated LLVM IR

🧪 Development

cargo test --release    # 14 unit tests + end-to-end tests that compile and run every example
cargo fmt && cargo clippy

🗺️ Roadmap

  • নাও: read input from the keyboard
  • Joining text with +, and converting numbers to text
  • for-style loops, থামো (break)
  • A browser playground for classrooms

📄 License

MIT

শুভ প্রোগ্রামিং! 🎈

About

আলভীলান: a Bangla programming language for kids. Bangla keywords, digits and error messages; compiles to native code via LLVM.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages