/**** **** Defintions for parser.y. ****/ #ifndef FILE #include #endif /* * YYSTYPE is the union of parser value stack items. */ typedef union { struct { char *text; AttachStruct attachment; SrcLoc loc; } keyword; struct { char *text; AttachStruct attachment; SrcLoc loc; } YYSident; struct { int val; AttachStruct attachment; SrcLoc loc; } YYSinteger; struct { float val; AttachStruct attachment; SrcLoc loc; } YYSreal; struct { char val; AttachStruct attachment; SrcLoc loc; } YYSchar; struct { char *val; AttachStruct attachment; SrcLoc loc; } YYSstring; struct { char* val; AttachStruct attachment; SrcLoc loc; } YYSsymlit; nodep nodeptr; } YYSTYPE_TYPE; /* * In bison, YYSTYPE is a macro, not a typedef. This sucks. */ #define YYSTYPE YYSTYPE_TYPE /* * PARSE_ERROR is a flag set to true when any error occurs -- it will inhibit * pretty printing, type checking, and other subsequent passes of the parse * tree. The reason we don't want to pretty print, etc., after an * error is the that the parse tree may be in a bad state, and neither the * pretty printer nor the type checker protect themselves at all from * erroneous parse trees. * * This is only a temporary solution -- the right way to do it is to have the * tree cleaned up after a parsing error, so at least some intermediate * results can be printed. Anyway, later for this. */ bool PARSE_ERROR; typedef enum{SPEC_LANG, MODULA2_LANG}langType; langType parse_language; static nodep parsetree = null; FILE *CurInFile(); /* * Visible functions */ nodep parser(); /* nodep mparser(); */