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

General discussion about LÖVE, Lua, game development, puns, and unicorns.
substitute541
Party member
Posts: 484
Joined: Fri Aug 24, 2012 9:04 am
Location: Southern Leyte, Visayas, Philippines
Contact:

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

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.
Currently designing themes for WordPress.

Sometimes lurks around the forum.

slime
Solid Snayke
Posts: 2863
Joined: Mon Aug 23, 2010 6:45 am
Contact:

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

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.

undef
Party member
Posts: 438
Joined: Mon Jun 10, 2013 3:09 pm
Location: Berlin
Contact:

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

Haxe transpiles to Lua now too.
Bartbes once quickly made a love wrapper for that.

pgimeno
Party member
Posts: 1979
Joined: Sun Oct 18, 2015 2:58 pm

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

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?

slime
Solid Snayke
Posts: 2863
Joined: Mon Aug 23, 2010 6:45 am
Contact:

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

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.

technomancy
Prole
Posts: 44
Joined: Thu Oct 29, 2015 8:25 am
Location: Thailand
Contact:

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

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

pgimeno
Party member
Posts: 1979
Joined: Sun Oct 18, 2015 2:58 pm

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

is MetaLua of any help? http://metalua.luaforge.net/

s-ol
Party member
Posts: 1077
Joined: Mon Sep 15, 2014 7:41 pm
Location: Cologne, Germany
Contact:

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

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

s-ol.nu /blog  -  p.s-ol.be /st8.lua  -  g.s-ol.be /gtglg /curcur

Code: Select all

print( type(love) )
if false then
baby:hurt(me)
end

technomancy
Prole
Posts: 44
Joined: Thu Oct 29, 2015 8:25 am
Location: Thailand
Contact:

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

s-ol wrote:Not what Sol? I'm close to Lua
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

s-ol
Party member
Posts: 1077
Joined: Mon Sep 15, 2014 7:41 pm
Location: Cologne, Germany
Contact:

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

technomancy wrote:
s-ol wrote:Not what Sol? I'm close to Lua
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.

s-ol.nu /blog  -  p.s-ol.be /st8.lua  -  g.s-ol.be /gtglg /curcur

Code: Select all

print( type(love) )
if false then
baby:hurt(me)
end

Who is online

Users browsing this forum: No registered users and 4 guests