Hi! This blog is for news, announcements and questions regarding the
Mascara JavaScript compiler.

See also:
The online demo
Download latest release

Contact:
olav@olav.dk

Disclaimer:
ECMAScript is a trademark of Ecma International.

Powered by Squarespace
« Mascara 1.1 and ECMAScript 5 | Main | Mascara 1.0 Released »
Tuesday
Jul282009

What is an execution backend?

The latest Mascara release have improved support for changing execution backends, and now includes Mozilla Rhino as the default backend.

The execution backend is not a necessary part of the compilation/translation process and you can run Mascara fine without one.

However an execution backend is useful if you want to compile and execute the generated code in one step. This is especially useful if you have a set of unit-tests you want to run on the compiled code immediately after compilation.

Previously cscript.exe (Microsofts command-line version of JScript) were the default backend, but it is only available on Windows. Rhino is in Java, and will run on any system with Java, and since it is distributed as part of Mascara, you don't have to do anything extra to get it to work.

I still recommend cscript.exe above Rhino though. The reason is that cscript.exe reports line number and character position of runtime errors. This allows Mascara to trace back and find the corresponding position in the original source code, which makes debugging a lot easier. Rhino sadly does not always report line number of runtime errors.

The execution backend is invoked on the command line like this:

translate.py inputfile.esx --execute --backend rhino

The --execute parameter indicated that the translated code should be executed by the backend. The --backend parameter indicates the name of the backend (rhino or cscript). If the --backend parameter is left out, it defaults to the one specified in config.py (which is rhino by default).

PrintView Printer Friendly Version

EmailEmail Article to Friend

Reader Comments

There are no comments for this journal entry. To create a new comment, use the form below.

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
Post:
 
Some HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>