[antlr-interest] ANTLR ActionScript target broken

Stefan seaside.ki at me.com
Thu Jun 23 14:47:41 PDT 2011


Hi,

According to these instructions, I'm trying to use ANTLR generated *.as files in a current Flash Builder 4.5.1 project.

Therefore, I added this ANTLR's Actionscript runtime to my project - without problems.

I compiled lexer/parser specs using ANTLRWorks without problems too.

I added the language option to the source *.g file to make ANTLR generate Actionscript sources:

options {
    backtrack = true; 
    memoize = true;
    k=2;
    output = AST;
    language=ActionScript;        // Added this
    ASTLabelType = CommonTree;
}
Unfortunately, the ANTLR/ANTLRworks generated Actionscript code is buggy:

Catch statements read like this catch (RecognitionException re), but should read like this:catch ( re:RecognitionException ).

Furthermore, Flash Builder complains about the use of Array here:

public override function get tokenNames():Array { return PhpParser.tokenNames; }
Besides this, other problems exist in the generated ActionScript sources. E.g. wrong function declaration, 
package declaration inside package, ChartStream.getLine() called instead of ChartStream.line(),...

I checked ANTLR itself too. But the pure JAR renders the same problem. Thus, ANTLRworks isn't the 
problem, but ANTLR itself.

Assuming that I did everything correct, I wonder if and when the ANTLR project may provide a bug fix.

Ah, hints how to make the current ANTLR work with ActionScript, would be even better ;-)


Kinds regards,

S


More information about the antlr-interest mailing list