[antlr-interest] Throwing an excption in a Tree Action

Niall Gormley ngormley at hotmail.com
Thu Jun 20 09:38:17 PDT 2002


Monty,

Thanks.

Another question to for you all to ponder.

I'm doing multiple tree walker manipulations for source to source 
translation.

Has anyone any suggestions for the location of the Symbol Table?

Should it go in a SubClassed TreeParser?

Thanks,
Niall


>From: mzukowski at yci.com
>Reply-To: antlr-interest at yahoogroups.com
>To: antlr-interest at yahoogroups.com
>Subject: RE: [antlr-interest] Throwing an excption in a Tree Action
>Date: Thu, 20 Jun 2002 08:37:14 -0700
>
>No, you currently can't specify specific Exceptions that a rule can throw.
>You have to make sure that the exceptions you throw are subclasses of
>RecognitionException.
>
>Monty
>
> > -----Original Message-----
> > From: Niall Gormley [mailto:ngormley at hotmail.com]
> > Sent: Thursday, June 20, 2002 8:35 AM
> > To: antlr-interest at yahoogroups.com
> > Subject: [antlr-interest] Throwing an excption in a Tree Action
> >
> >
> > Hi,
> >
> > I would like to throw an exception in an action as per the
> > grammar below. Is
> > it possible to specify that it should throw my
> > InvalidAssignmentException
> > exception in the tree grammar?
> >
> > Thanks Again,
> > Niall
> >
> > assignmentExpression
> >   : #( ASSIGN i:IDENT p:primaryExpression)
> >     {
> >       System.out.println("Checking Assignment Statement:
> > "+#i.getText()
> >                                                  +" "+#p.getText());
> >       if(#i.getType()!=#p.getType())
> >       {
> >         throw new InvalidAssignmentException("Cannot assign"
> >            + #i.getType() + " to " +  #p.getType());
> >       }
> >       else
> >       {
> >         System.out.println("Assingment OK");
> >       }
> >     }
> >   ;
> >
> > _________________________________________________________________
> > Send and receive Hotmail on your mobile device: http://mobile.msn.com
> >
> >
> >
> >
> > Your use of Yahoo! Groups is subject to
>http://docs.yahoo.com/info/terms/
>
>
>
>
>Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/


_________________________________________________________________
MSN Photos is the easiest way to share and print your photos: 
http://photos.msn.com/support/worldwide.aspx


 

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



More information about the antlr-interest mailing list