# Clx – Compile Lua to Native Executables Through C++20

Hi HN, clx is an ahead-of-time compiler for standard Lua that generates C++20 and produces standalone native executables through GCC, Clang or MSVC. The project started as an experiment to see whether modern C++ could be used as a portable compiler backend instead of LLVM or direct machine code gen…

- **Page:** https://magpie.gallery/i/clx-compile-lua-to-native-executables-through-c-20-uh0u
- **Type:** Link to an idea elsewhere
- **Category:** AI & dev
- **Runs on:** windows, macos, linux
- **Tags:** compiler, lua, c++, native, performance

## Source

Web · _samt_: Clx – Compile Lua to Native Executables Through C++20

- **Original:** https://news.ycombinator.com/item?id=48871547

> Hi HN, clx is an ahead-of-time compiler for standard Lua that generates C++20 and produces standalone native executables through GCC, Clang or MSVC. The project started as an experiment to see whether modern C++ could be used as a portable compiler backend instead of LLVM or direct machine code generation. The generated code is then compiled and optimized by the host toolchain. The latest release replaces the previous NaN-tagged value representation with a new shadow-types implementation, adds full int64 support, improves native arithmetic code generation and adds ARM64 macOS coroutine support. Performance is typically much faster than the Lua interpreter and can outperform LuaJIT on some computation-heavy workloads while remaining fully ahead-of-time compiled. The repository also contains graphical examples written in Lua, including a Pong game and a Mandelbrot explorer using a Sokol binary module (using the clx C++ API) I'd be very interested in feedback on clx :) https://github.com/samyeyo/clx

## GitHub projects

- https://github.com/samyeyo/clx

## Rules for reuse

- Build your own version: don't copy another product's code, look, icons, colours or copy.
- The original belongs to its author; Magpie only links to it.
- The original content's copyright belongs to its creator. Magpie doesn't download or re-upload it; we only show the link and the official preview.
