Skip to content

CDR2003/coffee-script-lua

 
 

Repository files navigation

------------------------------------------------------------------------------

    This project is deprecated.
    For things like coffeescript for Lua,
    Please check out this great project: http://moonscript.org

------------------------------------------------------------------------------


This is project is forked from coffee-script. See http://coffeescript.org for details.

Since CoffeeScript is such a good language, and Lua is somehow similar to JavaScript, make a compiler that compiles from CoffeeScript to Lua seems a good idea. It can be used in game programming without creating a new language.

We have several problems now:

* String concatenate operator.
  We've got '+' for string concatenation in CoffeeScript, JavaScript and many other languages, but in Lua, we got '..'. So if you cannot judge if a variable is string or not at compile time, it's not possible to convert '+' to '..'.

* Method invocation operator.
  In CoffeeScript and JavaScript, we use a syntax 'obj.method( ... )' to invoke methods, not static methods. But in Lua, we have to make it explicit with the operator ':'. In Lua, we have the syntax 'obj:method( ... )' to invoke methods, and 'type.method( ... )' or 'obj.method( ... )' to invoke static methods. And that means, we have to determine whether an Object present a type, or an instance. Without this information, we cannot convert '.' to ':'.

Packages

No packages published

Languages

  • CoffeeScript 95.6%
  • JavaScript 3.2%
  • Other 1.2%