PaulBernier / castl

JavaScript to Lua compiler with runtime library.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Compile failure

daurnimator opened this issue · comments

Errors found while trying to compile castl with castl:

shebang line not ignored. results in:

/opt/castl/lua$ ../bin/castl.js  ../bin/castl.js

/opt/castl/bin/castl.js:158
        throw new SyntaxError("Couldn't transpile JS code: " + e);
              ^
SyntaxError: Couldn't transpile JS code: Error: Line 1: Unexpected token ILLEGAL
    at /opt/castl/bin/castl.js:158:15
    at Object.<anonymous> (/opt/castl/bin/castl.js:280:2)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:906:3
  • bin/castl.js is Node JavaScript (hence the shebang) you're quite bold to try to compile this kind of JS with castl ^^ castl is aimed to compile regular ECMAScript 5.
  • Esprima doesn't (and won't) support parsing shebang: https://code.google.com/p/esprima/issues/detail?id=463.
  • the file bin/castl.js is only a command line tool to help compiling, it is not really castl itself. If you want the command line tool in Lua you should rewrite it yourself while using a compiled version of the castl.js file at the root.

So I won't fix that sorry.