Language

Language guide

Genzimnify is indentation-based, dynamically executed, and checked before it runs. Familiar programming ideas use a distinct vocabulary, while the native runtime owns their behavior.

Python-to-Genzimnify map

The two languages share many semantics, but Genzimnify is parsed and executed by its own native runtime. These are syntax equivalents, not a Python translation layer.

GenzimnifyPythonMeaning
nocap / cap / ghostTrue / False / NoneLiteral values
let x be 1 / x be 2x = 1 / x = 2Binding and assignment
vibecheck / or / otherwiseif / elif / elseConditional branches
vibewhileConditional loop
for real x up in valuesfor x in valuesIteration
cook / send itdef / returnFunctions
mini vibe / droplambda / yieldAnonymous functions and generators
clique / fam / newclass / self / __init__Classes and instances
f_around / find_out / no_matter_whattry / except / finallyException handling
throw shaderaiseRaise an exception
pull up / outta … pull upimport / from … importModules

Files, blocks, and comments

Source files use the .gzim extension. Newlines end statements; fr can explicitly end a statement or separate statements on one line. A colon opens a block and indentation defines its body.

# one-line comment
#[[
  multi-line comment
]]#

vibecheck nocap:
    yap("indentation is syntax") fr yap("fr can share a line")

Values and variables

let declares a mutable name. lock declares a name that cannot be rebound. Reassignment uses be.

let score be 10
score be score + 5

lock APP_NAME be "Genzimnify"
yap(APP_NAME, score)
ValueGenzimnifyPython equivalentDescription
Integer / float42, 3.1442, 3.14Native numeric values.
Text"hello""hello"Unicode text and multiline strings.
Truthnocap, capTrue, FalseBoolean values.
NoneghostNoneAbsence of a value.
Stack[1, 2, 3][1, 2, 3]Like a Python list.
Crew(1, 2)(1, 2)Like a Python tuple.
Squad{1, 2}{1, 2}Like a Python set.
Map{"a": 1}{"a": 1}Like a Python dict.

Glow strings

let name be "chat"
let score be 7
yap(glow"yo {name}, score: {score:03d}")

Use doubled braces—{{ and }}—for literal braces.

Operators

GenzimnifyPython equivalentPurpose
+ - * / // % **Same syntaxArithmetic, floor division, remainder, and power.
same as, nah==, !=Equality and inequality.
< <= > >=Same syntaxOrdering.
both, either, aintand, or, notBoolean logic.
up in, aint up inin, not inMembership.
literally, aint literallyis, is notIdentity.

Control flow

Conditions

vibecheck score > 90:
    yap("elite")
or score > 60:
    yap("we move")
otherwise:
    yap("time to lock in")

Loops

let i be 0
vibe i < 3:
    yap(i)
    i be i + 1

for real name up in ["amy", "bob"]:
    vibecheck name same as "bob":
        next
    yap(name)

dip breaks a loop. next continues with its next item.

Pattern matching

fit check status:
    fit 200:
        yap("ok")
    fit 404:
        yap("ghosted")
    otherwise:
        yap("unknown")

Cooks and calls

A function is a cook. Return with send it. A call is enclosed by call up and yo when it appears as a language-level call expression.

cook add(a, b be 1):
    send it a + b

let answer be call up add(41) yo
yap(answer)

Mini vibes

let double be mini vibe(x): x * 2
yap(call up double(21) yo)

Generators

drop yields values from a cook:

cook countdown(n):
    vibe n > 0:
        drop n
        n be n - 1

for real n up in call up countdown(3) yo:
    yap(n)

Collections and comprehensions

let squares be [n * n for real n up in vibes(6)]
let evens be [n for real n up in squares sus n % 2 same as 0]
let profile be {"name": "chat", "score": 100}

yap(evens)
yap(profile["name"])

Subscripts and slices support negative positions and steps: items[-1], items[1:4], and text[::-1].

Cliques

A class is a clique. The instance parameter is fam, and its initializer is new. Inherited methods can call ancestor.

clique Animal:
    cook new(fam, name):
        fam.name be name

    cook speak(fam):
        yap(glow"{fam.name} makes a sound")

clique Dog(Animal):
    cook new(fam, name):
        ancestor.new(fam, name)

    cook speak(fam):
        yap(glow"{fam.name} says woof")

let dog be call up Dog("Bit") yo
call up dog.speak() yo

Errors and cleanup

f_around:
    vibecheck amount < 0:
        throw shade BadVibe("amount must be positive")
find_out BadVibe as error:
    yap(glow"caught: {error}")
no_matter_what:
    yap("cleanup always runs")

Native exception names include L, BadVibe, WrongType, OutOfPocket, Ghosted, SplitByZero, NoPullUp, and CapDetected.

Modules

Import a native or local module with pull up. Local modules are other .gzim files resolved relative to the importing file.

pull up math
outta math pull up sqrt as root

yap(call up math.floor(2.9) yo)
yap(call up root(81) yo)

Type hints

Hints improve documentation and editor information. The native runtime remains dynamically typed.

cook label(score as num, name as text) gives text:
    send it glow"{name}: {score}"

let ids be [1, 2, 3] as stack[num]

Built-in hint names are num, drip, text, truth, stack, map, squad, crew, whatever, and nullable ?.

Async syntax

pull up timing

on timing cook main():
    wait up timing.sleep(0.1)
    yap("done")

call up timing.run(main()) yo
Current native runtime behavior

In version 2.0.2, the native scheduler executes timing tasks cooperatively and timing.sleep is non-blocking. A full event loop is not implemented.