Live data from Hacker News

Colony, an experimental JavaScript-to-Lua compiler

github.com

1–10 of 17 posts

Re: Colony, an experimental JavaScript-to-Lua compiler

#2
Hey all, I'm posting this to HN to see if there's any interest in a full-fledged JavaScript port to Lua. Colony right now is a proof-of-concept, but there might be a real use case out there for embeddable JavaScript where solutions like V8 would simply be too large.

Since it's a source-to-source compiler, you can use Colony generally wherever Lua source is required. For example, I was able to follow the beginners tutorials of the Corona SDK (http://www.anscamobile.com/corona/, a cross-platform mobile SDK that uses Lua) by programming CoffeeScript instead, which was surprisingly fun.

Re: Colony, an experimental JavaScript-to-Lua compiler

#5

Hey all, I'm posting this to HN to see if there's any interest in a full-fledged JavaScript port to Lua. Colony right now is a proof-of-concept, but there might be a real use case out there for embeddable JavaScript where solutions like V8 would simply be too large. Since it's a source-to-source compiler, you can use Colony generally wherever Lua source is required. For example, I was able to follow the beginners tut…

Hmm, you could target iphone wax https://github.com/probablycorey/wax to make a coffescript dev environment for iOS. Wax is a really nice environment.

Using javascript as a language instead of Lua for scripting though seems odd, as Lua is pretty easy to use instead.

Re: Colony, an experimental JavaScript-to-Lua compiler

#6
In which cases would anyone need:

- to write code in JS rather than in Lua;

- and run the result on a platform which supports Lua but not JS?

Except in a Dilbert-like situation, where a clueless middle manager decides that using a dirty hack is safer than letting JS programmers take the 2 days it would take them to become very proficient in Lua, I can't think of one.

Re: Colony, an experimental JavaScript-to-Lua compiler

#7
post #4

The fun thing about transpilers is that you can chain them together. Waiting to see some C stuff ported to Lua using Emscripten via JS.

Perhaps the best way to write a transpiler so there's no bugs is to write two of them at the same time, i.e. in this case Lua-to-JS and JS-to-Lua. Maybe it's easier to catch bugs.

This mirrors the idea of writing a compiler for a new language in itself as soon as possible.

Re: Colony, an experimental JavaScript-to-Lua compiler

#8
post #6

In which cases would anyone need: - to write code in JS rather than in Lua; - and run the result on a platform which supports Lua but not JS? Except in a Dilbert-like situation, where a clueless middle manager decides that using a dirty hack is safer than letting JS programmers take the 2 days it would take them to become very proficient in Lua, I can't think of one.

[deleted]

Re: Colony, an experimental JavaScript-to-Lua compiler

#9
post #6

In which cases would anyone need: - to write code in JS rather than in Lua; - and run the result on a platform which supports Lua but not JS? Except in a Dilbert-like situation, where a clueless middle manager decides that using a dirty hack is safer than letting JS programmers take the 2 days it would take them to become very proficient in Lua, I can't think of one.

Many C applications use Lua as an embedded scripting language. This program would be very useful if the developers of the application wanted to extend scripting support to Javascript (and compile-to-JS languages) without having to modify their C code.

Re: Colony, an experimental JavaScript-to-Lua compiler

#10
post #9
post #6

In which cases would anyone need: - to write code in JS rather than in Lua; - and run the result on a platform which supports Lua but not JS? Except in a Dilbert-like situation, where a clueless middle manager decides that using a dirty hack is safer than letting JS programmers take the 2 days it would take them to become very proficient in Lua, I can't think of one.

Many C applications use Lua as an embedded scripting language. This program would be very useful if the developers of the application wanted to extend scripting support to Javascript (and compile-to-JS languages) without having to modify their C code.

But if they are developers why would they not want to modify their own C code (to add an embeddable JS interpreter?)
Post reply on HN