Compiler Architecture
Hüma is a high-performance interpreter powered by Rust. Your source code is first tokenized, then transformed into a syntax tree, and finally executed by traversing the tree.
The Pipeline
Hüma source code passes through four main stages: Source Text, Lexer (Tokenizer), Parser, and Interpreter.
Lexer & Suffix System
The Hüma lexer strips Turkish grammatical suffixes (i'yi, yı, nı etc.) at compile time to determine the root word. This process has zero runtime cost.
12345// Kullanıcının yazdığı kod:isim'i yazdır;// Hüma Lexer'ı eki temizledikten sonra:// Token akışı: IDENT("isim") BUILTIN("yazdır") SEMI| Token | Examples | Notes |
|---|---|---|
| KEYWORD | olsun, ise, döngü | Reserved words |
| IDENT | isim, sayi, araç | Suffix-stripped names |
| NUMBER | 42, 3.14 | Numeric literals |
| STRING | "Hüma" | String literals |
| BUILTIN | yazdır, ekle | Built-in functions |
| PUNCT | { } ( ) ; , | Delimiters |
Abstract Syntax Tree (AST)
The parser transforms the token stream into a tree of Rust enums. Each node represents a language construct: statements, expressions, and blocks.
12345678910111213141516171819// Kaynak:topla fonksiyon olsun a, b alsın { a + b'yi döndür}// Basitleştirilmiş AST Yapısı:FunctionDecl { name: "topla", params: ["a", "b"], body: [ ReturnStmt { value: BinaryExpr { op: "+", left: Ident("a"), right: Ident("b") } } ]}Full AST node definitions live in 'crates/huma-core/src/ast.rs'. The recursive descent parser is in 'crates/huma-core/src/parser.rs'.
Build from Source
To build the Hüma compiler on your machine, a stable Rust toolchain (rustup) is required.
# Hüma derleyicisini kaynaktan derleyincargo build --release# Çalıştırılabilir dosya buradadır:./target/release/huma# Bir dosyayı çalıştırın:./target/release/huma çalıştır ornek.hb# veya İngilizce alias:./target/release/huma run ornek.hb