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

General discussion about LÖVE, Lua, game development, puns, and unicorns.
User avatar
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?

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

Sometimes lurks around the forum.
User avatar
slime
Solid Snayke
Posts: 3166
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

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

Post 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.
User avatar
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?

Post by undef »

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

Check out quadrant on Steam!
User avatar
pgimeno
Party member
Posts: 3672
Joined: Sun Oct 18, 2015 2:58 pm

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

Post 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?
User avatar
slime
Solid Snayke
Posts: 3166
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

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

Post 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.
User avatar
technomancy
Prole
Posts: 49
Joined: Thu Oct 29, 2015 8:25 am
Location: Thailand
Contact:

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

Post 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
User avatar
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?

Post 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

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
User avatar
technomancy
Prole
Posts: 49
Joined: Thu Oct 29, 2015 8:25 am
Location: Thailand
Contact:

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

Post 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
User avatar
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?

Post 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.

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
Post Reply

Who is online

Users browsing this forum: No registered users and 8 guests