C:/Users/Dennis/src/lang/russell.orig/src/pass1/applinfer/precedence.c

Go to the documentation of this file.
00001 # include "parm.h"
00002 
00003 # include "stree/ststructs.mh"
00004 
00005 # include "precedence.h"
00006 
00007 extern int yynerrs;
00008 extern int pend[];
00009 
00010 precedence(p) /* return the operator precedence associated with */
00011               /* denotation p.                                  */
00012 NODE * p;
00013 {
00014     register unsigned stti;  /* string table index of id */
00015     register int lvl;
00016 
00017         switch (p -> kind) {
00018                 case BLOCKDENOTATION :
00019             return(p -> bld_precedence);
00020         case USELIST :
00021             return(p -> usl_precedence);
00022         case WORDCAND :
00023             return(2);
00024         case WORDCOR :
00025             return(1);
00026         case OPRID :
00027         case LETTERID :
00028             stti = p -> id_str_table_index;
00029             if (stti > pend[NLEVELS - 1])
00030                 if((p -> kind) == OPRID)
00031                     return(3 /* default precedence */);
00032                 else
00033                     return(INFINITE);
00034             for (lvl = 0; stti > pend[lvl]; lvl++);
00035             return(lvl);
00036         default :
00037             return(INFINITE);
00038     }
00039 }

Generated on Fri Jan 25 10:39:46 2008 for russell by  doxygen 1.5.4