ECMAScript:Harmony/ES6 到 JavaScript 编译器

阅读 Peter 关于 JavaScript 的文章后我注意到了

Brendan Eich 表示,Harmony 的目标之一是成为 JavaScript 编译器的更好目标.

Brendan Eich stated that one the goals for Harmony is to be a better target for to-JavaScript compilers.

目前有两个流行的编译器具有一些模糊的ES:Harmony 合规性:

There are currently two popular compilers with some vague ES:Harmony compliance:

  • Traceur
  • CoffeeScript

尽管 CoffeeScript 有一些合规性,但它并不是为 ES:Harmony 编译器而设计的,因此它对此没有用处.

Although CoffeeScript has some compliance it's not designed to be an ES:Harmony compiler so it's not useful to this end.

Tracuer 似乎更严格地遵守 ES:Harmony 规范,但我不知道它是否打算成为一个完整的 ES:Harmony 编译器.

Tracuer seems to be sticking more rigorously to the ES:Harmony specification but I don't know whether it intends to become a full ES:Harmony compiler.

由于目标是将 ES6 编译为 ES3,因此还需要支持 ES5 功能(并且可能需要切换是将 ES5 编译为 ES3 还是将 ES6 编译为 ES3).

Since the aim is to to compile ES6 down to ES3 it would also need to support ES5 features (and probably a switch whether to compile ES5 to ES3 or ES6 to ES3).

  1. 目前是否还有其他项目旨在创建完整的 ES:Harmony to ES3 编译器?
  2. 在知道标准是年轻/不稳定/不断变化的情况下开始编写这样的编译器是否明智.
  3. 目前是否有任何 ES5 -> ES3 编译器?

我在 Traceur 邮件列表上留下了一个问题.

I've left a question on the Traceur mailing list.

这种编译器的目标是向后兼容 ES3.没有在 ES3 中完全模拟 ES5 和 ES6.

The aim of such a compiler would be backwards compatibility with ES3. Not full emulation of ES5 and ES6 in ES3.

推荐答案

Continuum 已经实现了大部分相关功能,应该在 es3 浏览器(如旧版 IE)中运行.

Continuum has implemented most of the relevant features and should run in es3 browsers (like older IEs).

相关文章