Page 1 of 2

(General Lua) A language that compiles to LuaJIT 2.0 bytecode?

Posted: Sat Jun 25, 2016 3:04 am
by substitute541
This is probably not the appropriate place to ask (I should check the lua-wiki mailing list sometime) but I'm wondering if someone has implemented a language that compiles to LuaJIT 2.0 bytecode?

Alternatively a language that compiles to Lua 5.1 bytecode then decompiled as Lua code, then passed in LuaJIT?

Because Java apparently has lots of languages for its VM (Clojure, Scala, Groovy, etc.) and I was wondering if there was any equivalent.

Re: (General Lua) A language that compiles to LuaJIT 2.0 bytecode?

Posted: Sat Jun 25, 2016 6:48 am
by slime
There are a few languages that compile to plain Lua. Moonscript is one example.

In general languages don't target Lua bytecode because said bytecode is system architecture- and Lua version-dependent.

Re: (General Lua) A language that compiles to LuaJIT 2.0 bytecode?

Posted: Sat Jun 25, 2016 12:27 pm
by undef
Haxe transpiles to Lua now too.
Bartbes once quickly made a love wrapper for that.

Re: (General Lua) A language that compiles to LuaJIT 2.0 bytecode?

Posted: Sat Jun 25, 2016 6:00 pm
by pgimeno
slime wrote:In general languages don't target Lua bytecode because said bytecode is system architecture- and Lua version-dependent.
Do you mean that if I distribute a LÖVE game with the files compiled as LuaJIT (not Lua) bytecode, it won't work in all platforms?

Re: (General Lua) A language that compiles to LuaJIT 2.0 bytecode?

Posted: Sat Jun 25, 2016 6:14 pm
by slime
Correct.

LuaJIT 2.0's bytecode is the same for all architectures it supports. It does not support arm64 (the architecture/instruction set used in most - but not all - iOS devices, and some Android devices). LuaJIT 2.1's bytecode is different from 2.0's, and also within LuaJIT 2.1 it has two separate incompatble sets of bytecode: one for most platforms except arm64, and another currently only used for arm64 (but with support in development for x86_64). So just within LuaJIT 2.0/2.1 you already have 3 different incompatible Lua bytecode targets.

LOVE currently uses LuaJIT 2.0 on desktops, and LuaJIT 2.1 on Android and iOS. As soon as LuaJIT 2.1 is officially out of beta, future desktop versions of LOVE will ship with it.

Re: (General Lua) A language that compiles to LuaJIT 2.0 bytecode?

Posted: Thu Jul 28, 2016 1:26 pm
by technomancy
I know this isn't quite what you asked, but I am using l2l for a small part of my game: https://github.com/meric/l2l

Instead of compiling to bytecode, it compiles directly to Lua source, which makes it a lot simpler to debug.

Of course Moonscript is the canonical answer to this question, and while it's a very impressive feat, I disagree with a number of the directions it takes.

Sol (no, not *that* Sol) is very close to lua, but with type safety: https://github.com/emilk/sol (Unfortunately it appears abandoned.)

Finally, here's a Forth implementation in Lua: http://angg.twu.net/miniforth-article.html It uses its own bytecode.

Anyway, my game is all about programming, so I am very interested in finding new languages that run on the LuaJIT runtime in order to add more diversity. So far I haven't found a good non-dead candidate for a static language that compiles *to* Lua, but I am considering interoperating with Lily using LuaJIT's FFI: https://jesserayadkins.github.io/lily

Re: (General Lua) A language that compiles to LuaJIT 2.0 bytecode?

Posted: Thu Jul 28, 2016 9:20 pm
by pgimeno
is MetaLua of any help? http://metalua.luaforge.net/

Re: (General Lua) A language that compiles to LuaJIT 2.0 bytecode?

Posted: Sat Jul 30, 2016 12:34 am
by s-ol
technomancy wrote:I know this isn't quite what you asked, but I am using l2l for a small part of my game: https://github.com/meric/l2l

Instead of compiling to bytecode, it compiles directly to Lua source, which makes it a lot simpler to debug.

Of course Moonscript is the canonical answer to this question, and while it's a very impressive feat, I disagree with a number of the directions it takes.

Sol (no, not *that* Sol) is very close to lua, but with type safety: https://github.com/emilk/sol (Unfortunately it appears abandoned.)
Not what Sol? I'm close to Lua :P

Re: (General Lua) A language that compiles to LuaJIT 2.0 bytecode?

Posted: Sat Jul 30, 2016 12:59 am
by technomancy
s-ol wrote:Not what Sol? I'm close to Lua :P
Hah! I meant the ancestor language of Lua.
Lua's historical "father and mother" were the data-description/configuration languages SOL (Simple Object Language) and DEL (data-entry language).
-- https://en.wikipedia.org/wiki/Lua_%28pr ... anguage%29

Re: (General Lua) A language that compiles to LuaJIT 2.0 bytecode?

Posted: Tue Aug 02, 2016 3:52 am
by s-ol
technomancy wrote:
s-ol wrote:Not what Sol? I'm close to Lua :P
Hah! I meant the ancestor language of Lua.
Lua's historical "father and mother" were the data-description/configuration languages SOL (Simple Object Language) and DEL (data-entry language).
-- https://en.wikipedia.org/wiki/Lua_%28pr ... anguage%29
Oh yeah, I saw it referenced before and I would love to get my hands on some original SOL code, documentation or even better a compiler source or something similar but I couldn't find anything.