{"by":"_samt_","descendants":32,"id":48871547,"kids":[48941777,48942758,48949581,48943505,48944730,48942021,48941434,48944633,48946267,48944391],"score":143,"text":"Hi HN,<p>clx is an ahead-of-time compiler for standard Lua that generates C++20 and produces standalone native executables through GCC, Clang or MSVC.<p>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.<p>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.<p>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.<p>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)<p>I&#x27;d be very interested in feedback on clx :)","time":1783773624,"title":"Show HN: Clx – Compile Lua to Native Executables Through C++20","type":"story","url":"https://github.com/samyeyo/clx"}