You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add a Lua binding generator backend for alef, alongside the existing 16 backends (Python/Node/Ruby/PHP/Elixir/Go/Java/C#/WASM/R/Kotlin/Gleam/Zig/Dart/Swift + the C-FFI base).
Approach
Lua is a C FFI consumer (analogous to Go, Java, C#, Zig in the existing codebase). It reuses the cbindgen-produced shared library and consumes the C ABI via Lua's ffi (LuaJIT) or mlua/lua-ffi-rs for standard Lua 5.4.
Stage A: New crate crates/alef-backend-lua/ skeleton (Cargo.toml, lib.rs, gen_bindings.rs returning Ok(vec![]), type_map.rs with LuaMapper: TypeMapper impl). Wire into crates/alef-cli/src/registry.rs and crates/alef-core/src/config/extras.rs::Language.
Stage B: struct/enum/function emission. Lua tables as DTOs; metatables for OOP-style enums; error() for Result error propagation.
Stage C: error wrapping (Lua pcall pattern), async via coroutines.
Stage 1b: scaffold (rockspec), e2e (busted), publish (LuaRocks tarball). Add LUA_KEYWORDS to crates/alef-core/src/keywords.rs (mirroring the cross-cutting follow-up fix(codegen): prefix unused Map key with underscore #7 pattern in the plan).
Pin versions
Add to crates/alef-core/src/template_versions.rs::luarocks (new submodule) — list of test/lint dep versions with Renovate markers (// renovate: datasource=...).
Effort estimate
S–M (~3–5 days for one engineer; similar to Zig).
Tracking
Part of Tier 2 (community-contribution) per the language-backend expansion plan. Other Tier 2 langs being filed: OCaml, Nim, Julia.
Goal
Add a Lua binding generator backend for alef, alongside the existing 16 backends (Python/Node/Ruby/PHP/Elixir/Go/Java/C#/WASM/R/Kotlin/Gleam/Zig/Dart/Swift + the C-FFI base).
Approach
Lua is a C FFI consumer (analogous to Go, Java, C#, Zig in the existing codebase). It reuses the cbindgen-produced shared library and consumes the C ABI via Lua's
ffi(LuaJIT) ormlua/lua-ffi-rsfor standard Lua 5.4.Reference implementation
The Zig backend is the closest template:
crates/alef-backend-zig/src/{lib.rs, gen_bindings.rs, type_map.rs}alef-codegen::c_consumer::{free_string_symbol, last_error_code_symbol, last_error_context_symbol}crates/alef-scaffold/src/languages/zig.rscrates/alef-e2e/src/codegen/zig.rscrates/alef-publish/src/package/zig.rsSuggested scope (stage discipline)
crates/alef-backend-lua/skeleton (Cargo.toml,lib.rs,gen_bindings.rsreturningOk(vec![]),type_map.rswithLuaMapper: TypeMapperimpl). Wire intocrates/alef-cli/src/registry.rsandcrates/alef-core/src/config/extras.rs::Language.error()for Result error propagation.pcallpattern), async via coroutines.rockspec), e2e (busted), publish (LuaRocks tarball). AddLUA_KEYWORDStocrates/alef-core/src/keywords.rs(mirroring the cross-cutting follow-up fix(codegen): prefix unused Map key with underscore #7 pattern in the plan).Pin versions
Add to
crates/alef-core/src/template_versions.rs::luarocks(new submodule) — list of test/lint dep versions with Renovate markers (// renovate: datasource=...).Effort estimate
S–M (~3–5 days for one engineer; similar to Zig).
Tracking
Part of Tier 2 (community-contribution) per the language-backend expansion plan. Other Tier 2 langs being filed: OCaml, Nim, Julia.