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

draft
STEP 01
Source Text
.hb (UTF-8)
text_fields
STEP 02
Lexer
Tokens & Suffixes
account_tree
STEP 03
Parser
AST Builder
play_arrow
STEP 04
Interpreter
Tree-walk

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.

lexer_analizi.txt
1
2
3
4
5
// Kullanıcının yazdığı kod:
isim'i yazdır;
// Hüma Lexer'ı eki temizledikten sonra:
// Token akışı: IDENT("isim") BUILTIN("yazdır") SEMI
TokenExamplesNotes
KEYWORDolsun, ise, döngüReserved words
IDENTisim, sayi, araçSuffix-stripped names
NUMBER42, 3.14Numeric literals
STRING"Hüma"String literals
BUILTINyazdır, ekleBuilt-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.

ast_yapisi.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// 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")
}
}
]
}
codeSource: crates/huma-core/src/ast.rs

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.

Terminal — Bash
# Hüma derleyicisini kaynaktan derleyin
cargo 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
memory
LANGUAGE
Rust (stable)
scale
LICENSE
MIT
link
REPOSITORY
huma-lang