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'.
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.
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.
12345678// Değişken Tanımlama (Variable Declaration)isim = "Hüma" olsun // 'olsun' is an assignment operatorsayı = 10 olsun // Type determined by value// Ek sistemi kullanımı (Suffix System)// Apostrophe (') is used to separate grammatical suffixesisim'i yazdır; // The compiler strips 'isayı'yı yazdır; // The compiler strips 'yı| Hüma | Equivalent | Purpose |
|---|---|---|
| olsun | let / var | Declare or update a variable |
| yazdır | print() | Output a value to stdout |
| döndür | return | Return from a function |
| ile | with | Particle-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.
12345678// Koşul Blokları (Conditionals)puan = 85 olsunpuan > 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.
123456789101112// Döngüler (olduğu sürece — while)sayaç = 0 olsunsayaç < 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;}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 toplaPostfix Yükle
"mat.hb"'yi yükle