refactor(lang): rename builtins flr->floor and fx->fixed

De-abbreviate the two bare fixed-point conversion builtins:
  flr(f) -> int     ->  floor(f) -> int    (fixed -> int, flooring)
  fx(i)  -> fixed   ->  fixed(i) -> fixed  (int -> fixed; mirrors how the
                                            stringify builtin is `string`)

Updates the compiler dispatch, all call sites, the grammars/LSP/JetBrains
tokens, and the docs (fn-flr -> fn-floor, fn-fx -> fn-fixed). Reseeded;
C-free fixpoint holds; all suites green (45/24/29); site + check.py OK.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-08-30 02:01:56 +03:00
parent effb3f637f
commit 2e0047514b
19 changed files with 80 additions and 80 deletions

View file

@ -436,8 +436,8 @@ function emit_call(e: Node) -> Val {
let w = emit_bind(`zext i32 {by} to i64`)
return val(emit_bind(`call ptr @malloc(i64 {w})`), "words")
}
if (name == "fx") { let a = emit_expr(e.kids[0]); return val(emit_bind(`shl i32 {a.code}, 16`), "fixed") }
if (name == "flr") { let a = emit_expr(e.kids[0]); return val(emit_bind(`ashr i32 {a.code}, 16`), "int") }
if (name == "fixed") { let a = emit_expr(e.kids[0]); return val(emit_bind(`shl i32 {a.code}, 16`), "fixed") }
if (name == "floor") { let a = emit_expr(e.kids[0]); return val(emit_bind(`ashr i32 {a.code}, 16`), "int") }
# The EV2 reflection ABI (the world table), exposed to Ludic so a Ludic mod can
# introspect the world by name — the same functions a foreign mod binds. Emitted
# only for a modding program (ECS + events), so a plain game is unchanged.

View file

@ -3602,11 +3602,11 @@ declare void @win_close()
@.str3501 = private unnamed_addr constant [22 x i8] c"call ptr @malloc(i64 \00"
@.str3502 = private unnamed_addr constant [2 x i8] c")\00"
@.str3503 = private unnamed_addr constant [6 x i8] c"words\00"
@.str3504 = private unnamed_addr constant [3 x i8] c"fx\00"
@.str3504 = private unnamed_addr constant [6 x i8] c"fixed\00"
@.str3505 = private unnamed_addr constant [9 x i8] c"shl i32 \00"
@.str3506 = private unnamed_addr constant [5 x i8] c", 16\00"
@.str3507 = private unnamed_addr constant [6 x i8] c"fixed\00"
@.str3508 = private unnamed_addr constant [4 x i8] c"flr\00"
@.str3508 = private unnamed_addr constant [6 x i8] c"floor\00"
@.str3509 = private unnamed_addr constant [10 x i8] c"ashr i32 \00"
@.str3510 = private unnamed_addr constant [5 x i8] c", 16\00"
@.str3511 = private unnamed_addr constant [4 x i8] c"int\00"

View file

@ -2,11 +2,11 @@ program T {
entry {
let half = 0.5
let a = 1.5
print(flr(a + half)) # flr(2.0) = 2
print(flr(a * 2.0)) # flr(3.0) = 3
print(floor(a + half)) # floor(2.0) = 2
print(floor(a * 2.0)) # floor(3.0) = 3
let third = 1.0 / 3.0
print(flr(third * 3.0)) # ~flr(1.0) = 1 (may be 0 with rounding)
print(flr(fx(5) + a)) # flr(6.5) = 6
print(floor(third * 3.0)) # ~floor(1.0) = 1 (may be 0 with rounding)
print(floor(fixed(5) + a)) # floor(6.5) = 6
if a > half { print(1) } else { print(0) } # 1
}
}