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!).
torsdag den 10. juli 2008
Abonner på:
Kommentarer til indlægget (Atom)
This blog has moved to http://blog.mascaraengine.com. See you!
This blog is (was) for news, announcements and questions regarding the
Mascara ECMAScript 6 -> JavaScript translator.
This blog is (was) for news, announcements and questions regarding the
Mascara ECMAScript 6 -> JavaScript translator.
4 kommentarer:
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/
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);
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.
Thanks for answering. I figured that was the case.
Send en kommentar