This repository is a defluent Lua variant focused on internationalization: locale-driven keywords/operators/diagnostics, symbolic-locale stress support, and kernel-locale bootstrap/generation paths integrated in the build.
For the official Lua project, language reference, releases, and upstream communication, use Lua.org, the download page, and the Lua mailing list.
In short: this repo tracks Lua core evolution while intentionally diverging to explore and validate end-to-end interpreter localization.
A kernel locale is the compile-time default locale baked into the interpreter for bootstrap-facing tokens/labels and initial locale loading behavior. It is selected with LUA_KERNEL_LOCALE during build.
Default host-aware flags are set in makefile, so a plain make should compile on supported Linux/Darwin setups.
List currently supported locale names:
find locale -mindepth 2 -maxdepth 2 -name '*.lua' | sed 's#^locale/##; s#/[^/]*\\.lua$##' | sort -umake clean
make MYCFLAGS='-std=c99 -DLUA_USE_LINUX' MYLDFLAGS='-Wl,-E' MYLIBS='-ldl' CC=gccBuild with a different default kernel locale and regenerate its kernel header:
make locale-build LUA_KERNEL_LOCALE='<locale-name>' \
MYCFLAGS='-std=c99 -DLUA_USE_LINUX' \
MYLDFLAGS='-Wl,-E' MYLIBS='-ldl' CC=gccmake clean
make MYCFLAGS='-std=c99 -DLUA_USE_WINDOWS' MYLDFLAGS='' MYLIBS='' CC=gccBuild with a different default kernel locale:
make locale-build LUA_KERNEL_LOCALE='<locale-name>' \
MYCFLAGS='-std=c99 -DLUA_USE_WINDOWS' \
MYLDFLAGS='' MYLIBS='' CC=gccmake clean
make MYCFLAGS='-std=c99 -DLUA_USE_POSIX -DLUA_USE_DLOPEN -DLUA_READLINELIB="\"/opt/homebrew/opt/readline/lib/libreadline.dylib\""' MYLDFLAGS="" MYLIBS="" CC=ccBuild with a different default kernel locale:
make locale-build LUA_KERNEL_LOCALE='<locale-name>' \
MYCFLAGS='-std=c99 -DLUA_USE_POSIX -DLUA_USE_DLOPEN -DLUA_READLINELIB="\"/opt/homebrew/opt/readline/lib/libreadline.dylib\""' \
MYLDFLAGS="" MYLIBS="" CC=ccFor all platforms, <locale-name> maps to locale/<locale-name>/<locale-name>.lua and regenerates locale/<locale-name>/<locale-name>_kernel_autogenerated.h. The committed bootstrap header lives at locale/native/native_kernel_autogenerated.h. Use LUA_KERNEL_LOCALE=native to return to the native default.
Shorthand target aliases also exist per locale directory name. For example:
make esperanto
make native
make 'symbolic·transpraxis'Each is equivalent to make locale-build LUA_KERNEL_LOCALE=<that-locale>.
They reuse the same host-aware defaults as plain make.
A kernel locale is the compile-time default baked into the interpreter's bootstrap. It affects:
- Lexer token names in error diagnostics (e.g.,
syntax error near 'xyz'vseraro ĉe ...) - Interactive prompt labels and REPL messages
- Initial locale fallback when
LUA_LOCALEis not set - The locale loaded at startup to initialize keyword/operator/diagnostic mappings
Pros of kernel locales:
- Diagnose syntax errors in the native language without relying on runtime locale loading
- Smaller startup overhead (locale names/keywords already in binary)
- Consistent experience for interactive REPL users in that language
- Useful for embedded use (single-locale deployments)
Cons of kernel locales:
- Requires recompilation to change default language
- Larger binary (kernel locale header is ~5KB per locale)
- Less flexibility than pure runtime locales
Runtime locale fallback:
If the kernel locale fails to load at startup (e.g., missing locale/<kernel>/ directory), the interpreter falls back to the base English kernel and attempts to load the locale file specified by LUA_LOCALE environment variable or the hardcoded default.
When switching between kernel locales (make native, make esperanto, etc.), the build system tracks the active kernel locale in .last-kernel-locale. This stamp file enables incremental builds:
- First build (
make esperanto): Full recompile, writesesperantoto.last-kernel-locale - Repeated build with same locale (
make esperantoagain): Zero recompilation (stamp matches, source unchanged) - Locale switch (
make native): Detects stamp mismatch, runsmake clean, recompiles, updates stamp
This avoids the overhead of forced full rebuilds when running locale-specific test sweeps (e.g., for l in native esperanto symbolic·transpraxis; do make $l && ./lua ...; done).
Note: .last-kernel-locale is automatically generated and should not be committed (see .gitignore).
Quick end-to-end validation (from repository root):
./lua utilitary/internationalization-healthcheck