Nelua: AOT statically typed Lua
nelua.io
nelua.io
The author made a custom client (https://github.com/edubart/otclient) for the game that is still very much in active use by thousands of players. He's a very skilled developer.
Great to see AOT compiled Lua, I know of the other solutions: Luau (from Roblox), Teal, TypeScriptToLua, Terra, etc., but this one is my favorite so far.
Love the simple compilation to C (and WASM support via Emscripten). Though Terra's JIT is enticing and good replacement for LuaJIT, this is for embedded systems, it's a good replacement for Lua PUC-Rio.
Typed Lua Projects:
- https://github.com/teal-language/tl
- https://typescripttolua.github.io/
There's also a language server for Lua dialects for type checking in the IDE:
> not all Lua features are implemented yet. Most of the dynamic parts, such as tables and handling dynamic types at runtime
It has coroutines to some extent
> At the moment Nelua does not support variable arguments in yield and resume (unlikely Lua).
It also extends lua primitives - lots of control flow things, arrays and records which look like tables but are passed by value, not by reference.
So it's an ahead of time statically typed language which looks somewhat like lua. Compiled to C, no interpreter. It says it's meta-programmable using lua which I assume is really confusing given the two languages look similar and behave differently.
It’s been used successfully to make games for virtual game consoles like wasm4 and GamerCade.
Must be fun to debug generated C code.
The interop benefits of compile-to-C are so useful for my work that it's always exciting to see another language take advantage of it. Of course it has some downsides, but being able to leverage existing C libraries (source-based or binary-libs) with the worlds simplest bindings is fantastic, even when those source based libraries do really funky things with macros and such. Inspecting the C output of the language to ensure the binding matches is great :)
I was interested in Terra a while back, but it didn't seem to get a lot of traction. This three-year-old critique put the nail in the coffin for me:
> Terra is C if you replaced the preprocessor with Lua.
This is what is written on the tin.
PUC made there own version of Terra
Pallene http://www.inf.puc-rio.br/~roberto/docs/Gualandi-2020-SCP.pd...
https://github.com/pallene-lang/pallene
https://www.youtube.com/watch?v=H3inzGGFefg
This is a good writeup on all the Alt-Luas https://injuly.in/blog/gsoc/
Nelua Programming Language - https://news.ycombinator.com/item?id=28293836 - Aug 2021 (118 comments)
This seems to mean that you can't drop a Nelua script into a game/engine and use it. You have to compile the script and link with the game? Something with either an interpreted mode or runtime code generation seems more appropriate.
> The initial motivation for its creation was to replace C/C++ parts of projects which currently uses Lua with a language that has syntax and semantics similar to Lua, but allows for fine-grained performance optimizations and does not lose the ability to go low level, therefore unifying the syntax and semantics across both compiled and dynamic languages.
So it's ideal if you have an app written in (dynamic) Lua and use Nelua for AOT parts to speed it up.
You should try crystal lang if you love writing ruby code.
crystal lang has both interpreter and compiler, so that you can debug with interpreter during development and run compiled binary in production.
For example, you can't express this in crystal, like in Typescript:
type Easing = "ease-in" | "ease-out" | "ease-in-out";https://github.com/crystal-lang/crystal/issues/10281#issueco...
I wish the same could be said about tooling
How is the debugging story? gdb/ldb compatible? does it support its types?
Is there a language server available? formatter?
As it is compile-to-C and the #line macro is very easy to output in these languages, I'd nearly guarantee "yes" as the answer to that.
Despite nothing else really being aware of Nim, I debug embedded firmware written in it, on a microcontroller via JTAG and gdb/openocd, and it works perfectly.
I feel like plugin support would be best but I've no idea how that's supposed to work in the presence of a predefined grammar. There's also so many variants I don't think there's a good way to build out a composite grammar.
Does anyone have any ideas about modular/extendable language parsing? For reference, I'm using https://github.com/JetBrains/Grammar-Kit.
Who was the first to do it? Why? What did they inspire?
I take it Jonathan Blow has been a significant inspiration, but there's clearly prior art to this approach.
The paper describes the language Pallene
(openresty) is luajit + nginx
Been that way for a long time, so I imagine it has been pretty optimized over the decades.
https://techdocs.f5.com/kb/en-us/products/big-ip_ltm/manuals...
"Tcl, The How and Why"
https://web.archive.org/web/20131205081839/https://devcentra...
The title makes it sound like this is a variant of Lua, or somehow largely compatible.
The page itself is more clear, calling it a "programming language with a Lua flavor".
Emphasis on "flavor".
I feel like the list of differences from Lua is about as big as the similarities, and it's definitely not a drop-in replacement, at least in its current form (contrast with something like LuaJIT).
As a strategy to get adopters, it could also have value. There's a small but widely spread group of people who have been exposed to Lua in various games and programs.
Beyond that, I have grown to somewhat dislike Lua over the years due to the typical complaints, but also because it's tough to read and write. The keywords are so bulky and whitespace practices are random, requiring a linter. I actually like using brackets instead of do/then/end because brackets stand out more. When you're tossing functions around left and right, it's annoying to write out "local function" everywhere. I also am ambivalent about using metatables for implicit behavior that can be non-obvious to the code reader.