We are currently working on new rules for what content should and shouldn't be allowed on this website, and are looking for feedback! See Esolang:2026 topicality proposal to view and give feedback on the current draft.

Mkhedruli

From Esolang
Jump to navigation Jump to search

This programming language has nothing to do with any of SLet-serie programming language (including Polynomix), and also has nothing to do with a writing system of Georgian.

Mkhedruli is a programming language designed by PSTF.

Overview

It is a programming language that bridges the expressive, array-oriented power of Jelly and APL with the syntactic clarity of modern practical languages (Python, Rust, JavaScript). It replaces Jelly's cryptic implicit chains with explicit bindings (let), structured blocks ({ }), and familiar control flow (if, while, for) – all while offering a vast, multicultural instruction set drawn from ASCII, Latin Extended, Cyrillic, Greek, Armenian (with eternity symbols), Georgian, basic Kana, modern Hangul, CJK ideographs, APL symbols, and technical/geometric/mathematical glyphs.

Philosophy & Core Syntax

  • Dynamic, strong typing – scalar, string, array (nested), dict, function.
  • Scalar functions broadcast over arrays (APL-style rank polymorphism). [1, 2, 3] + 1 → [2, 3, 4]
  • Explicit imperative skeleton – no implicit _ or __ arguments. Tacit programming is opt‑in via combinators.
  • Lexical scoping with closures.
  • Precedence: standard mathematical order (PEMDAS) with APL array operators binding tighter than arithmetic. Use ( ) freely.

Extremely Simplified EBNF

Program      ::= (Stmt | FuncDef)*
FuncDef      ::= "fn" Ident "(" [Ident ("," Ident)*] ")" Block
Stmt         ::= "let" Ident "←" Expr ";"
               | "if" Expr Block ("else" Block)?
               | "while" Expr Block
               | "for" Ident "in" Expr Block
               | "return" Expr ";"
               | "break" ";"
               | "continue" ";"
               | Expr ";"
Block        ::= "{" Stmt* "}"
Expr         ::= PrefixOp Expr | Expr InfixOp Expr | Primary
Primary      ::= Number | String | "[" Expr ("," Expr)* "]" | "{" Expr "=>" Expr "}" (dict)
               | Ident | "(" Expr ")"
PrefixOp     ::= "¬" | "√" | "⍳" | "⌊" | "⌈" | "-" | "λ" | "イ" | "ウ" | "オ" | "数" | ...
InfixOp      ::= "+" | "-" | "*" | "/" | "^" | "×" | "÷" | "⍴" | "⍉" | "⌽" | "Σ" | ...

The Complete Instruction Set (by Writing System)

ASCII – The Practical Foundation

Keywords, standard arithmetic, logic, and control.

Category	Symbols / Keywords			Meaning
Keywords	let, fn, if, else, while, for,
		return, import, break, continue, in	As in C/Python.
Arithmetic	+ - * / % ^				Add, sub, mul, div, mod, exponent.
Comparison	< > <= >= = !=				Standard equality / ordering.
Logic		& | ~					Bitwise AND, OR, NOT (overloaded for booleans).

Latin Extended – Extra Maths

Common extended‑ASCII math operators.

Symbol	Name			Meaning
±	Plus‑minus		a ± b → array of [a+b, a-b].
²	Superscript 2		x² → x*x.
³	Superscript 3		x³ → x*x*x.
×	Multiplication cross	Alias for *.
÷	Division sign		Alias for /.
√	Square root		Unary: √ x.

Cyrillic – Array Geometry

Mirrors common APL primitives. <ore> Symbol Name Meaning Ж Zhe Transpose (alias for ⍉). Ч Che Reshape (alias for ⍴). Я Ya Reverse array (alias for ⌽).

Greek – Functional & Reductive Power

Reductions, composition, and selection.

Symbol	Name		Meaning
λ	Lambda		Anonymous function: λ x → x * 2.
Σ	Summation	Fold / reduce with addition: Σ [1,2,3,4] → 10.
Π	Product		Fold with multiplication: Π [1,2,3,4] → 24.
α	Alpha		First element (head).
ω	Omega		Last element (tail).
δ	Delta		Drop first n elements: 2 δ [1,2,3,4] → [3,4].
τ	Tau		Take first n elements: 2 τ [1,2,3,4] → [1,2].
Θ	Theta		Rotate left by n: 1 Θ [1,2,3] → [2,3,1].
∘	Composition	(f ∘ g)(x) ← f(g(x)).
ι	Iota		Range: ι 5 → [0,1,2,3,4].
ρ	Rho		Shape (unary) / Reshape (binary). ρ arr → [rows, cols]; 10 ρ [1,2] → [1,2,1,2,1,2,1,2,1,2].

Armenian – Eternity & Control Flow

Includes the official Armenian eternity symbols ֍ and ֎.

Symbol	Name			Meaning
֍	Eternity (left)		While‑loop synonym: ֍ cond { ... }.
֎	Eternity (right)	Infinite loop: ֎ { ... } (use break to exit).
Letters (e.g. Ա, Բ)		Allowed in identifiers	Variables / function names.

In fact, all the characters are allowed for identifiers, only if they do not contract the keywords.f

Georgian (Mkhedruli) – List Processing

Case‑insensitive – we show lowercase forms.

Symbol	Name	Meaning
ა	Ani	Head (first element, alias for α).
ბ	Bani	Tail (all but first, alias for 1 δ).
გ	Gani	Group‑by: გ(arr, key_fn) → dict of arrays.
დ	Doni	Drop while condition true.
ე	Eni	Enumerate: returns [[idx, val], …].

Kana (Basic Hiragana / Katakana) – Type & I/O

Only the core 46 characters; we use Katakana for built‑in operations.

Symbol	Reading	Meaning
イ	I	Cast to integer (イ "42" → 42).
ウ	U	Cast to string (ウ 42 → "42").
エ	E	Throw exception / panic (エ "oops").
オ	O	Cast to float.
カ	Ka	Read from file (input).
キ	Ki	Write to file (output).
ク	Ku	Keyboard input (read line).

Hangul (Modern) – Logic & Set Theory

Symbol	Name	Meaning
가	Ga	Logical AND (alias for ∧).
나	Na	Logical OR (alias for ∨).
다	Da	Logical NOT (alias for ¬).
라	Ra	Unique elements (deduplicate).
마	Ma	Length / count (마 arr → len).
바	Ba	Set difference (a 바 b).
사	Sa	Set intersection (a 사 b).

Chinese (CJK Basic Block) – High‑Level Introspection and Aliases for Keywords

Symbol	Hanzi	Meaning
数	shù	Type test: is number?
集	jí	Convert array to set.
序	xù	Sort ascending.
逆	nì	Sort descending.
函	hán	Type test: is function?
列	liè	Convert to array (list).
若	ruò	If.
否	fǒu	Else.
令	lìng	Let.
...

Special Symbols – APL, Technical, Geometric, Mathematical

The crown jewels – original APL glyphs plus extra technical shapes.

Symbol	APL Name		Meaning
⍪	Catenate vertical	Stack arrays row‑wise.
⍉	Transpose		Swap axes of matrix.
⌽	Reverse			Reverse along last axis.
⊖	Reverse vertical	Reverse along first axis.
⍋	Grade up		Indices for ascending sort.
⍒	Grade down		Indices for descending sort.
⌊	Floor			Largest integer ≤ x.
⌈	Ceiling			Smallest integer ≥ x.
⊥	Decode			Base conversion (e.g., 2 ⊥ [1,0,1] → 5).
⊤	Encode			Inverse of decode.
∧	And			Logical AND (scalar / vectorised).
∨	Or			Logical OR.
¬	Not			Logical NOT, alias for !.
≠	Not equal		Scalar / vectorised.
≡	Match			Deep equality (structure & values).
≢	Not match		Deep inequality.
⍣	Power operator		Function iteration: f ⍣ 3 applies f three times.
⍨	Commute			Swap arguments: x f⍨ y → y f x.
⌺	Stencil			Sliding window (like n ⌺ arr).
⌸	Key			Key‑by‑group (like group‑by index).	
∠	Angle			Computes polar angle.
∡	Measured angle		Alias for ∠.
○	Circle			π × r² (area) or ○ x → π*x.
□	Square			Alias for ².
∞	Infinity		Literal infinity.
⌻	Quadrant		Used for custom user‑defined glyphs (macro placeholder).
⌼	Diaeresis		Apply verb to sub‑arrays (rank operator).

How Mkhedruli Is Syntactically Simpler Than Jelly/APL

Feature			Jelly / APL		Mkhedruli
Variable binding	Implicit (_, __, ³)	Explicit let x ← …
Function definition	Monadic/dyadic chains	fn name(args) { … }
Control flow		None / complex forks	Standard if, while, for (ASCII) and ideographs in Chinese
Operator overloading	No visible mapping	All symbols are optional; ASCII aliases exist
Code blocks		Right‑to‑left tacit	Left‑to‑right with parentheses when needed

You can write entirely ASCII programs if you wish – the exotic symbols enrich, but never force, the "golfing" style.

Examples

Fibonacci

fn fib(n) {
    let a ← 0
    let b ← 1
    let i ← 0
    while i < n {
        let temp ← a + b
        a ← b
        b ← temp
        i ← i + 1
    }
    return a
}
print(fib(10))  # 55

1²+3²+5²+7²+...+99²

let odds ← ⍳ 100           # [0..99]
let result ← Σ (odds²) where odds mod 2 ≠ 0

Cat Program

֎ {
    令 input ← ク()   # read input
    if input = "quit" { 退 }
    ウ(input)
}

Implementation Notes =

Lexer
Matches the longest valid Unicode symbol first. Comments start with # or /* */.
Arrays
Nested arrays are supported. Scalar functions (e.g., +, ¬, ⌊) automatically map over arrays recursively (depth‑1 by default, configurable with ⌼).
Operator overloading
All symbols can be bound to custom functions via the import system.
Case sensitivity
ASCII and Latin are case‑sensitive; Georgian is case‑insensitive (internally normalised). All other scripts are case‑sensitive where applicable (Kana, Hangul, CJK have no case).

Why “Mkhedruli”?

Like a woven fabric, this language threads together the symbolic heritage of humanity – from the eternity signs of Armenia to the logic gates of Hangul, the matrix maths of APL, and the structural clarity of ASCII. It gives you the freedom to code in the glyphs that resonate with your problem domain, while remaining grounded in a clean, explicit, beginner‑friendly grammar.

Summary

Mkhedruli is not a toy; it is a production‑ready vehicle for mathematical exploration, data transformation, and expressive meta‑programming – all without sacrificing readability.

See Also