1
/* Abstract syntax tree
7
* We reserve no LEGAL rights to the Purdue Compiler Construction Tool
8
* Set (PCCTS) -- PCCTS is in the public domain. An individual or
9
* company may do whatever they wish with source code distributed with
10
* PCCTS or the code generated by PCCTS, including the incorporation of
11
* PCCTS, or its output, into commerical software.
13
* We encourage users to develop software with PCCTS. However, we do ask
14
* that credit is given to us for developing PCCTS. By "credit",
15
* we mean that if you incorporate our source code into one of your
16
* programs (commercial product, research project, or otherwise) that you
17
* acknowledge this fact somewhere in the documentation, research report,
18
* etc... If you like PCCTS and have developed a nice tool with the
19
* output, please mention that you developed it using PCCTS. In
20
* addition, we ask that this header remain intact in our source code.
21
* As long as these guidelines are kept, we expect to continue enhancing
22
* this system and expect to make other tools available as they are
27
* Parr Research Corporation
28
* with Purdue University and AHPCRC, University of Minnesota
36
if ( zzast_sp <= 0 ) \
38
fprintf(stderr, zzStackOvfMsg, __FILE__, __LINE__); \
39
exit(PCCTS_EXIT_FAILURE); \
42
#ifndef USER_DEFINED_AST
48
struct _ast *right, *down;
50
struct _ast *left, *up;
58
#define AST_REQUIRED_FIELDS struct _ast *right, *down, *left, *up;
60
#define AST_REQUIRED_FIELDS struct _ast *right, *down;
66
/* N o d e a c c e s s m a c r o s */
67
#define zzchild(t) (((t)==NULL)? (AST *) NULL:(t->down)) /* MR19 */
68
#define zzsibling(t) (((t)==NULL)? (AST *) NULL:(t->right)) /* MR19 */
71
/* define global variables needed by #i stack */
73
AST *zzastStack[ZZAST_STACKSIZE]; \
74
int zzast_sp = ZZAST_STACKSIZE;
76
#define zzASTVars AST *_ast = NULL, *_sibling = NULL, *_tail = NULL
77
#define zzSTR ( (_tail==NULL)?(&_sibling):(&(_tail->right)) )
78
#define zzastCur (zzastStack[zzast_sp])
79
#define zzastArg(i) (zzastStack[zztsp-i])
80
#define zzastPush(p) zzastOvfChk; zzastStack[--zzast_sp] = p;
81
#define zzastDPush --zzast_sp
82
#define zzastMARK zztsp=zzast_sp; /* Save state of stack */
83
#define zzastREL zzast_sp=zztsp; /* Return state of stack */
84
#define zzrm_ast {zzfree_ast(*_root); _tail = _sibling = (*_root)=NULL;}
87
extern AST *zzastStack[];
91
#ifdef PCCTS_USE_STDARG
92
AST *zztmake(AST *, ...);
98
void zzlink(AST **, AST **, AST **);
99
void zzsubchild(AST **, AST **, AST **);
100
void zzsubroot(AST **, AST **, AST **);
101
void zzpre_ast(AST *, void (*)(AST *), void (*)(AST *), void (*)(AST *));
102
void zzfree_ast(AST *);
103
AST *zzdup_ast(AST *);
105
void zzdouble_link(AST *, AST *, AST *);
118
void zzdouble_link();