[antlr-interest] AS3 output from AntlrWorks seems incompatible with runtime SWC

Simon Cave simon at simoncave.info
Tue Aug 18 16:05:02 PDT 2009


Hi,

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 fromhttp://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 {
             }

I'm just getting started with Antlr and I greatly appreciate any help  
the community can give me on this one. Please let me know if posting  
these files will help.

Thanks,

Simon Cave


More information about the antlr-interest mailing list