views:

69

answers:

0

I'm trying to use ANTLR to create a simple math parser targetting AS3 (Flash). I am using the latest version of AntlrWorks (1.2.3) on a Mac and have downloaded the runtime SWC from http://antlr.org/download/ActionScript/antlr3.swc.

The generated code looks fine, but seems to be incompatible with the runtime. There are many compile-time issues due to missing ancestor functions, constants and variables. For example, both the lexer and the parser want to override grammarFileName() but it is not defined in either of the base classes in the runtime.

In addition to this, some Java seems to have found its way into the generated parser class:

       catch (FailedPredicateException fpe) {

               String tvt = (tv!=null?tv.text:null);
               String msg = "In function \"" + fnt +
                 "\" the term variable \"" + tvt +
                 "\" doesn't match function variable \"" + fvt + "\".";
               throw new RuntimeException(msg);

       }
       finally {
       }