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
« Version 0.3.6 | Main | Automatic semicolon insertion »
Thursday
Jul102008

Version 0.3 released

Anyway, version 0.3 is now available for download. The minor version bump is because syntax parsing is now largely functionally complete. You shouldn't get random crashes anymore if you hit some unsupported syntax -- rather you will get a friendly error message telling you that the particular syntax is not supported (yet).

One particular parser improvement worth mentioning is support for the forbidden linebreak rule. For example, a line break between the return keyword and following value is not allowed. So this is legal:

return 7;

but this is a syntax error:

return
7;

...unless of course you have enabled automatic semicolon insertion (as described in the previous blog post), in which case the last example will be parsed as:

return;
7; <- will never be seen

Which is probably not what you want! Another reason to keep automatic semicolon insertion disabled.

Additionally, line-break is forbidden between break/continue and a following label, between a variable and a following ++ or -- unary operator, and between attributes and the following statement. In all other contexts line breaks just count as ordinary whitespace. (Unless, of course, automatic semicolon insertion is enabled!).

PrintView Printer Friendly Version

EmailEmail Article to Friend

Reader Comments (4)

Keep up the great work! I'm going to try out Mascara today on a small file for my web site, just to get a feel for it.

I covered Mascara in my blog here...

http://dreaminginjavascript.wordpress.com/2008/07/10/welcome-mr-future-javascript-programmer/

July 10, 2008 | Unregistered Commentertimothy

It seems like you've not yet implemented destructuring assignment.

var x,y;
[x,y]=[1,2];
console.log(x,y);

The translator passes that code right through. That's fine for Firefox, which will run that code now, but isn't your target JS 1.2?

I expected the translator to do this:

var x,y;
x=1;y=2;
console.log(x,y);

July 10, 2008 | Unregistered Commentertimothy

Hi timothy,
thanks for the nice words. I like the slogan of Tomorrows JavaScript Today :-)

You are right that the aim is to support lowest common denominator JavaScript.

As you have discovered, a few unsupported features which only works in Firefox are passed through without any errors. Array comprehensions is another example.

This is just temporary until I get around to implement the transformations for these features.

July 11, 2008 | Unregistered CommenterOlav Junker Kjær

Thanks for answering. I figured that was the case.

July 11, 2008 | Unregistered Commentertimothy

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>