Back to News
Advertisement
__samt_ 6 days ago 4 commentsRead Article on github.com

RU version is available. Content is displayed in original English for accuracy.

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 :)

Advertisement

⚡ Community Insights

Discussion Sentiment

50% Positive

Analyzed from 70 words in the discussion.

Trending Topics

#eval#neat#inspiration#shedskin#python#compiler#perf#numbers#decent#optimizations

Discussion (4 Comments)Read Original on HackerNews

sitkackabout 1 hour ago
Neat, did you take any inspiration from Shedskin? It is a Python to C++ compiler.

The perf numbers look decent. What optimizations are you the most proud of?

Do you have plans for eval? what would stop you from supporting eval?

valorzardabout 2 hours ago
Does the backend output c++20? If so, why? I’m curious what specific features you guys are using from c++20.

Have c++20 coroutines been useful at all?

arikrahmanabout 3 hours ago
Interesting, will be pairing this with my Funnel setup and see how it goes.
cjbgkagh14 minutes ago
Fennel the lisp on Lua or something else?