Tim Cameron Ryan
Computer stuff maker from Boston, Massachusetts.
Student at Olin College of Engineering.
See the projects I've been working on.
Or view my resume.
-
Mug: JavaScript Compiler for the JVM »
A few months ago I wrote about compiling CoffeeScript into Java. Since then I’ve wanted to use JavaScript on a few target platforms running Java, so I’ve developed a complete JavaScript compiler for the JVM.
Rhino is the de-facto JavaScript interpreter for Java, but Mug has different priorities. There is no interpretation involved; all code is statically compiled before running. This has led to code running 2x as fast in some cases, compared to Rhino’s compiled mode. Mug’s standard library is comparatively small, just ~150k for its object classes and the default library. The biggest architectural difference is that Mug is modeled around CommonJS modules. Each compiled JavaScript file is an independent module and can be loaded using
require. Java interacts with JavaScript via itsexportsobject, and you can easily write modules entirely in Java to extend Mug’s capabilities.Mug implements much of the ECMAScript 3 spec right now, though it is still a work in progress. To get started, check out Mug on GitHub and the README. Let me know of any issues you find.
And to show you what Mug is capable of, here’s my related project, Mug running on Android.
Github
@timcameronryan
LinkedIn
Email me