[antlr-interest] Can't create AST Node?

Tiller, Michael (M.M.) mtiller at ford.com
Thu Jul 8 05:46:11 PDT 2004



> -----Original Message-----
> From: Ric Klaren [mailto:klaren at cs.utwente.nl]
> Sent: Thursday, July 08, 2004 5:04 AM
> To: antlr-interest at yahoogroups.com
> Subject: Re: [antlr-interest] Can't create AST Node?
> 
> On Wed, Jul 07, 2004 at 05:23:43PM -0400, Tiller, Michael (M.M.)
wrote:
> > I'm using antlr-2.7.4 with Java as the target language.  I'd like to
> > specify a custom default AST type.  I tried using the option
> > "ASTLabelType" but it gives me a casting error.  So I thought
perhaps
> > the ASTFactory wasn't building the correct type so I added
> > "parser.setASTNodeClass" to my Main routine.  Then I get a message
that
> > says "Can't create AST Node <xyz>".  That's odd!?
> 
> (I'm no expert on the java bit of this so just guessing here)
> 
> Could it be that you did parser.setASTNodeClass before setting the
> ASTFactory ? (parser.setASTNodeClass() forwards to
> astFactory.setASTNodeClass())

As far as I know, the Java side does not require the ASTFactory to be
initialized.  At least the examples don't show that.

> It could be helpfull to see on which variant of ASTFactory.create() it
> bombs out.

I agree.  In fact, it would be nice if the code that fails printed
information about the exception rather than just saying it couldn't
create it.  It would be nice to know *why*.

> Cheers,
> 
> Ric



 
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