[antlr-interest] AST typecasting problem?

Steve stevegianvecchio at hotmail.com
Tue Nov 9 16:24:56 PST 2004




I created this file:

public class BeliefAST extends antlr.CommonAST {
    List beliefList;
}

Then in a separated file:

...
AST t1 = parser.getAST();
BeliefAST t2 = (BeliefAST)t1;
System.out.println("I don't get here.");

At the second line, where the typecast takes place, my program exits 
immediately without any errors.  The following code works fine:

...
AST t1 = parser.getAST();
CommonAST t2 = (CommonAST)t1;
System.out.println("I don't get here.");

I can't think of what I'm doing wrong.  I tried replacing my 
BeliefAST file with CommonAST and just changing the text "CommonAST" 
to "BeliefAST" and got the same result.  I can't seem to figure out 
what is causing this, anyone have any ideas?








 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
    antlr-interest-unsubscribe at yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 





More information about the antlr-interest mailing list