--- /dev/null
+/* Abstract syntax tree\r
+ *\r
+ * Macros, definitions\r
+ *\r
+ * SOFTWARE RIGHTS\r
+ *\r
+ * We reserve no LEGAL rights to the Purdue Compiler Construction Tool\r
+ * Set (PCCTS) -- PCCTS is in the public domain. An individual or\r
+ * company may do whatever they wish with source code distributed with\r
+ * PCCTS or the code generated by PCCTS, including the incorporation of\r
+ * PCCTS, or its output, into commerical software.\r
+ *\r
+ * We encourage users to develop software with PCCTS. However, we do ask\r
+ * that credit is given to us for developing PCCTS. By "credit",\r
+ * we mean that if you incorporate our source code into one of your\r
+ * programs (commercial product, research project, or otherwise) that you\r
+ * acknowledge this fact somewhere in the documentation, research report,\r
+ * etc... If you like PCCTS and have developed a nice tool with the\r
+ * output, please mention that you developed it using PCCTS. In\r
+ * addition, we ask that this header remain intact in our source code.\r
+ * As long as these guidelines are kept, we expect to continue enhancing\r
+ * this system and expect to make other tools available as they are\r
+ * completed.\r
+ *\r
+ * ANTLR 1.33\r
+ * Terence Parr\r
+ * Parr Research Corporation\r
+ * with Purdue University and AHPCRC, University of Minnesota\r
+ * 1989-1998\r
+ */\r
+\r
+#ifndef ZZAST_H\r
+#define ZZAST_H\r
+\r
+#define zzastOvfChk \\r
+ if ( zzast_sp <= 0 ) \\r
+ { \\r
+ fprintf(stderr, zzStackOvfMsg, __FILE__, __LINE__); \\r
+ exit(PCCTS_EXIT_FAILURE); \\r
+ }\r
+\r
+#ifndef USER_DEFINED_AST\r
+#ifndef AST_FIELDS\r
+#define AST_FIELDS\r
+#endif\r
+\r
+typedef struct _ast {\r
+ struct _ast *right, *down;\r
+#ifdef zzAST_DOUBLE\r
+ struct _ast *left, *up;\r
+#endif\r
+ AST_FIELDS\r
+} AST;\r
+\r
+#else\r
+\r
+#ifdef zzAST_DOUBLE\r
+#define AST_REQUIRED_FIELDS struct _ast *right, *down, *left, *up;\r
+#else\r
+#define AST_REQUIRED_FIELDS struct _ast *right, *down;\r
+#endif\r
+\r
+#endif\r
+\r
+\r
+/* N o d e a c c e s s m a c r o s */\r
+#define zzchild(t) (((t)==NULL)? (AST *) NULL:(t->down)) /* MR19 */\r
+#define zzsibling(t) (((t)==NULL)? (AST *) NULL:(t->right)) /* MR19 */\r
+\r
+\r
+/* define global variables needed by #i stack */\r
+#define zzASTgvars \\r
+ AST *zzastStack[ZZAST_STACKSIZE]; \\r
+ int zzast_sp = ZZAST_STACKSIZE;\r
+\r
+#define zzASTVars AST *_ast = NULL, *_sibling = NULL, *_tail = NULL\r
+#define zzSTR ( (_tail==NULL)?(&_sibling):(&(_tail->right)) )\r
+#define zzastCur (zzastStack[zzast_sp])\r
+#define zzastArg(i) (zzastStack[zztsp-i])\r
+#define zzastPush(p) zzastOvfChk; zzastStack[--zzast_sp] = p;\r
+#define zzastDPush --zzast_sp\r
+#define zzastMARK zztsp=zzast_sp; /* Save state of stack */\r
+#define zzastREL zzast_sp=zztsp; /* Return state of stack */\r
+#define zzrm_ast {zzfree_ast(*_root); _tail = _sibling = (*_root)=NULL;}\r
+\r
+extern int zzast_sp;\r
+extern AST *zzastStack[];\r
+\r
+#ifdef __USE_PROTOS\r
+void zzlink(AST **, AST **, AST **);\r
+void zzsubchild(AST **, AST **, AST **);\r
+void zzsubroot(AST **, AST **, AST **);\r
+void zzpre_ast(AST *, void (*)(AST *), void (*)(AST *), void (*)(AST *));\r
+void zzfree_ast(AST *);\r
+AST *zztmake(AST *, ...);\r
+AST *zzdup_ast(AST *);\r
+void zztfree(AST *);\r
+void zzdouble_link(AST *, AST *, AST *);\r
+AST *zzastnew(void);\r
+\r
+#else\r
+\r
+void zzlink();\r
+AST *zzastnew();\r
+void zzsubchild();\r
+void zzsubroot();\r
+void zzpre_ast();\r
+void zzfree_ast();\r
+AST *zztmake();\r
+AST *zzdup_ast();\r
+void zztfree();\r
+void zzdouble_link();\r
+#endif\r
+\r
+#endif\r