Bbetlang

Keywords

betlang keywords mapped onto classic language constructs.

All 33 of betlang’s keywords are internet slang wearing the costume of a normal language construct. Each one compiles to exactly what you’d expect it to, because the compiler, for all its slang, has no sense of humor whatsoever.

Note

nocap and cap are the boolean literals (true and false). “No cap” is two words in real life, but the lexer wanted one, so one it is.

connectives
as≈ cast

Explicit type conversion: big as u8, f as int. Also renames an import: pull "a/b" as m.

in≈ binding connective

Ties several forms together: cop … in crib, squad x in xs, holla r = t in crib, evict t in crib, t.trust() in crib.

declarations
bet≈ return

Hand back the answer. Returns 0..n values: bet, bet x, bet a, ghosted.

drip≈ struct

A record type — "your data's outfit."

extern≈ extern (FFI)

Declare a foreign C symbol: extern "C" finna abs(x: i32) -> i32.

facts≈ const

A compile-time constant. It's facts — it doesn't change.

finna≈ fn

Declare a function ("finna do something"). Also heads a function-pointer type: finna(int) -> int.

lowkey≈ let / var

A mutable, reassignable binding (type inferred or annotated).

moods≈ enum / sum type

A tagged union with payload and nullary variants.

pull≈ import

Import a module (a sibling .bet file or a stdlib namespace).

concurrency & errors
bounce≈ early-return-on-error

Given an error value, return the zero values plus that error, collapsing the 3-line check.

sheesh≈ recover

A recover boundary: sheesh { … } naw p { … }. Rare/discouraged.

slide≈ go / spawn

Spawn a concurrent task: slide worker().

yeet≈ panic

Abort with a message: yeet("div by zero").

values
cap≈ false

"cap" (a lie) — the boolean false.

ghosted≈ nil / none / no-error

The value that never showed up. The nil-error literal and the "not present" sentinel.

nocap≈ true

"no cap" — the boolean true (one word: the lexer wants nocap).

memory
cop≈ allocate

Allocate into an arena: cop Player{ hp: 100 } in frame.

crib≈ arena declaration

Declare an arena: crib frame (untyped bump) or crib enemies: Enemy[1000] (typed slab).

evict≈ free

Free a whole crib (evict frame, O(1)) or one slot (evict tag in crib).

holla≈ checked deref

Checked handle access with two arms: holla r = t in crib { …live… } ghosted { …dead… }.

soa≈ struct-of-arrays layout

Store a container of structs transposed: soa Particle[4]. Access is unchanged.

tag≈ generational handle

An 8-byte handle into a typed crib: tag Enemy. Plain copyable data.

trust≈ unchecked deref

The unchecked escape hatch: t.trust() in crib (ugly and greppable on purpose).

control flow
dip≈ break

Dip out of the loop.

fr≈ if

"for real?" — the true branch.

naw≈ else

The negative branch. Also the wildcard arm in vibe matches and the recover arm of sheesh.

skip≈ continue

Skip to the next iteration.

squad≈ for … in

Iterate over a collection (the whole squad).

vibe≈ match / switch

Dispatch on a moods variant (exhaustive; naw is the catch-all).

vibin≈ while

Loop while the condition holds.

visibility
flex≈ pub / exported

Show it off — exported from the module, or a public struct field.

hush≈ private (the default)

Keep it quiet. The default when unmarked; can be written explicitly on a field.