ludic/selfhost
Orkuncakilkaya fcada23eba Phase 7a: bitwise operators & | ^ << >> ~ (retire band/bor/shl/…)
First step of the "stop feeling like C" pass. Bitwise ops were functions
(`band(x, MASK)`, `shl(a, 3)`); they are now real operators:

  band -> &   bor -> |   bxor -> ^   shl -> <<   shr -> >>   bnot -> ~

Precedence is Go-style so the C footgun is gone: `<<`/`>>`/`&` bind like `*`,
`|`/`^` like `+`, both tighter than comparison — `flags & MASK == 0` parses as
`(flags & MASK) == 0`. `>>` is logical (lshr), matching the old `shr`.

Mechanics: lexer tokenizes `<< >> & | ^ ~`; p_mul takes `<< >> &`, p_add takes
`| ^`, p_unary takes `~`; emit_bin routes them through the existing int arith
path (arith_code gains and/or/xor/shl/lshr) and E_UN handles `~`. The six
intrinsics are deleted.

Delivered as two reseeds: (A) add the operators keeping the intrinsics, (B)
migrate every call site to operator form (85 lines across compiler + runtime,
via a balanced-paren call->operator script; two multi-line big-endian reads in
image/truetype done by hand) and delete the intrinsics. Vocabulary drops the six
from LUDIC_INTRINSICS (ludic_syntax.h, grammar, LudicTokens.kt) and the grammar
gains a bitwise-operator rule. LANGUAGE.md precedence table rewritten.

Reseeded (21724 lines); C-free fixpoint holds; goldens byte-identical (the PNG
and TrueType decoders lean on these ops); 17/17; vocab + doc-fences clean.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-28 00:45:10 +03:00
..
golden Baseline: Ludic compiler + toolchain, Phase 1 syntax fixes complete 2026-08-27 15:15:35 +03:00
tests Phase 7a: bitwise operators & | ^ << >> ~ (retire band/bor/shl/…) 2026-08-28 00:45:10 +03:00
ast.ludic Phase 6d: merge struct into property; storage follows use 2026-08-27 23:32:05 +03:00
bootstrap-cfree.sh Phase 6a: rename core vocabulary (game/main/component/archetype/system) 2026-08-27 18:22:13 +03:00
bootstrap.sh Baseline: Ludic compiler + toolchain, Phase 1 syntax fixes complete 2026-08-27 15:15:35 +03:00
buf.ludic Phase 6f: let = immutable, var = mutable (binding-only) 2026-08-27 23:52:59 +03:00
build.sh Phase 6a: rename core vocabulary (game/main/component/archetype/system) 2026-08-27 18:22:13 +03:00
compile.sh Baseline: Ludic compiler + toolchain, Phase 1 syntax fixes complete 2026-08-27 15:15:35 +03:00
emit_addr.ludic Phase 2: enforce statement separators (Rule B) 2026-08-27 15:41:29 +03:00
emit_core.ludic Phase 6f: let = immutable, var = mutable (binding-only) 2026-08-27 23:52:59 +03:00
emit_decl.ludic Phase 6f: let = immutable, var = mutable (binding-only) 2026-08-27 23:52:59 +03:00
emit_ecs.ludic Phase 6f: let = immutable, var = mutable (binding-only) 2026-08-27 23:52:59 +03:00
emit_expr.ludic Phase 7a: bitwise operators & | ^ << >> ~ (retire band/bor/shl/…) 2026-08-28 00:45:10 +03:00
emit_game.ludic Phase 6f: let = immutable, var = mutable (binding-only) 2026-08-27 23:52:59 +03:00
emit_head.ludic Phase 6f: let = immutable, var = mutable (binding-only) 2026-08-27 23:52:59 +03:00
emit_intrin.ludic Phase 7a: bitwise operators & | ^ << >> ~ (retire band/bor/shl/…) 2026-08-28 00:45:10 +03:00
emit_intrin2.ludic Phase 2: enforce statement separators (Rule B) 2026-08-27 15:41:29 +03:00
emit_machine.ludic Phase 6f: let = immutable, var = mutable (binding-only) 2026-08-27 23:52:59 +03:00
emit_math.ludic Phase 6f: let = immutable, var = mutable (binding-only) 2026-08-27 23:52:59 +03:00
emit_new.ludic Phase 6f: let = immutable, var = mutable (binding-only) 2026-08-27 23:52:59 +03:00
emit_query.ludic Phase 6f: let = immutable, var = mutable (binding-only) 2026-08-27 23:52:59 +03:00
emit_save.ludic Phase 6f: let = immutable, var = mutable (binding-only) 2026-08-27 23:52:59 +03:00
emit_spawn.ludic Phase 6f: let = immutable, var = mutable (binding-only) 2026-08-27 23:52:59 +03:00
emit_stmt.ludic Phase 6f: let = immutable, var = mutable (binding-only) 2026-08-27 23:52:59 +03:00
emit_ui.ludic Phase 6f: let = immutable, var = mutable (binding-only) 2026-08-27 23:52:59 +03:00
game-build.sh Baseline: Ludic compiler + toolchain, Phase 1 syntax fixes complete 2026-08-27 15:15:35 +03:00
io.ludic Phase 6f: let = immutable, var = mutable (binding-only) 2026-08-27 23:52:59 +03:00
lex.ludic Phase 7a: bitwise operators & | ^ << >> ~ (retire band/bor/shl/…) 2026-08-28 00:45:10 +03:00
ludicc.seed.ll Phase 7a: bitwise operators & | ^ << >> ~ (retire band/bor/shl/…) 2026-08-28 00:45:10 +03:00
main.ludic Phase 7a: bitwise operators & | ^ << >> ~ (retire band/bor/shl/…) 2026-08-28 00:45:10 +03:00
parse.ludic Phase 7a: bitwise operators & | ^ << >> ~ (retire band/bor/shl/…) 2026-08-28 00:45:10 +03:00
parse_game.ludic Phase 6f: let = immutable, var = mutable (binding-only) 2026-08-27 23:52:59 +03:00
reseed.sh Phase 6a: rename core vocabulary (game/main/component/archetype/system) 2026-08-27 18:22:13 +03:00
str.ludic Phase 6f: let = immutable, var = mutable (binding-only) 2026-08-27 23:52:59 +03:00
test.sh Baseline: Ludic compiler + toolchain, Phase 1 syntax fixes complete 2026-08-27 15:15:35 +03:00