Syntax & Foundations

Hüma's syntax offers logical clarity and flexibility. In this section, we'll examine variable definition, data types, and the heart of the language: the 'Suffix System'.

auto_fixSuffix System

Hüma supports Turkish's agglutinative structure at the compiler level. All suffixes following the apostrophe (') are automatically stripped by the compiler, achieving both natural language and high performance.

ruleSyntax Scope Note

Suffix-aware forms primarily improve readability. Core semantics are preserved on normalized root tokens after lexing. Natural and normalized forms in examples are therefore treated as equivalent.

01Variable Definition

In Hüma, everything is a value. You can define both local and global variables with the 'olsun' keyword.

degiskenler.hb
1
2
3
4
5
6
7
8
// Değişken Tanımlama (Variable Declaration)
isim = "Hüma" olsun // 'olsun' is an assignment operator
sayı = 10 olsun // Type determined by value
// Ek sistemi kullanımı (Suffix System)
// Apostrophe (') is used to separate grammatical suffixes
isim'i yazdır; // The compiler strips 'i
sayı'yı yazdır; // The compiler strips 'yı
HümaEquivalentPurpose
olsunlet / varDeclare or update a variable
yazdırprint()Output a value to stdout
döndürreturnReturn from a function
ilewithParticle-based function call

02Conditionals (ise / yoksa)

Control the flow of your application with natural language logic. Hüma uses 'ise' (if) and 'yoksa' (else) keywords.

kosul.hb
1
2
3
4
5
6
7
8
// Koşul Blokları (Conditionals)
puan = 85 olsun
puan > 50 ise {
"Başarılı!"'yı yazdır;
} yoksa {
"Tekrar dene."'i yazdır;
}

03Loops (olduğu sürece / range)

Use 'olduğu sürece' for conditional loops, and 'dan ... e kadar' for numerical ranges.

dongu.hb
1
2
3
4
5
6
7
8
9
10
11
12
// Döngüler (olduğu sürece — while)
sayaç = 0 olsun
sayaç < 5 olduğu sürece {
"Sıra: " + sayaç'ı yazdır;
sayaç = sayaç + 1 olsun
}
// Aralık Döngüleri (Range Loops)
i = 0'dan 5'e kadar {
"Adım: " + i'yi yazdır;
}
warningLoop Guard

Always ensure the loop variable is mutated inside the body. Hüma's runtime can detect some infinite loops in strict mode.

04Particle and Postfix Calls

Hüma supports 'ile' (with) and 'yükle' (load) structures compatible with Turkish syntax.

Edatlı Çağrı (ile)

10 ile 20'yi topla

Postfix Yükle

"mat.hb"'yi yükle