The upcoming 6.1.0 release of JavaCC adds in a new "modern" code generation mode that, amongst other features, allows for GWT (ergo JavaScript) compatible parsers to be generated.

Now, for the first time, both Java and JavaScript parsers can be generated for your DSL - all from a single codebase.

A pair of new blog postings describes how to configure JavaCC grammar files and how to set up your Eclipse environment so that this new functionality can be leveraged.