[antlr-interest] JavaScript Target

Daniel Trebbien dtrebbien at gmail.com
Thu Aug 18 07:23:51 PDT 2011

Hello Jeff,

I know what you mean.  I recently tried using the JavaScript target with
v3.4 and was unable to do so.  I also tried building from source, but this
turns out to be fruitless as the JavaScript target only works with
v3.1, as stated
on the wiki page<http://www.antlr.org/wiki/display/ANTLR3/ANTLR3JavaScriptTarget>

Here's how to get started with ANTLR and the JavaScript back-end:

   1. Download ANTLRWorks 1.2.2:  <
   http://antlr.org/download/antlrworks-1.2.2.jar>.  The JavaScript target
   only works when the IDE generates the lexer and parser code (see <
   If you try to run ANTLR v3.1 from the command line, you will see the error
   message "error(10):  internal error: group JavaScript does not satisfy
   interface ANTLRCore".
   2. Download the JS runtime distribution:

>From then on you can use ANTLRWorks 1.2.2 to generate the lexer and parser
code by selecting "Generate Code" from the "Generate" menu.  ANTLRWorks will
place the generated files into an `output` directory in the folder in which
the grammar file resides.

Note that if an error occurs in the generation process, then for some reason
the "Generate Code" action no longer works.  Simply close the grammar and
re-open it from the "Open Recent" menu.

Daniel Trebbien

On Wed, Aug 17, 2011 at 8:22 PM, Jeff Hair <knifed at gmail.com> wrote:

> Hello,
> I tried generating a very simple "hello world" grammar with the JavaScript
> target using v 3.4. It put out a bunch of warnings and generated invalid
> code. In particular, it created a strange JS object literal like { : }. It
> had the colons but not the variables or values. Is this a known issue?
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe:
> http://www.antlr.org/mailman/options/antlr-interest/your-email-address

More information about the antlr-interest mailing list