ack/lang/pc/comp/node.xh

62 lines
1.7 KiB
Plaintext
Raw Normal View History

1988-10-26 15:21:11 +00:00
/* N O D E O F A N A B S T R A C T P A R S E T R E E */
#ifndef NODE_H_
#define NODE_H_
1988-10-26 15:21:11 +00:00
struct node {
struct node *nd_left;
#define nd_next nd_left
struct node *nd_right;
int nd_class; /* kind of node */
#define Value 0 /* constant */
#define Name 1 /* an identifier */
#define Uoper 2 /* unary operator */
#define Boper 3 /* binary operator */
#define Xset 4 /* a set */
#define Set 5 /* a set constant */
#define Call 6 /* a function call */
#define NameOrCall 7 /* call or name of function */
#define Arrow 8 /* ^ construction */
#define Arrsel 9 /* array selection */
#define Def 10 /* an identified name */
#define Link 11
#define LinkDef 12
#define Cast 13 /* convert integer to real */
1989-05-03 10:30:22 +00:00
#define IntCoerc 14 /* coercion of integers to longs */
#define IntReduc 15 /* reduction of longs to integers */
1988-10-26 15:21:11 +00:00
/* do NOT change the order or the numbers!!! */
struct type *nd_type; /* type of this node */
struct token nd_token;
#define nd_def nd_token.tk_data.tk_def
#define nd_set nd_token.tk_data.tk_set
#define nd_lab nd_token.tk_data.tk_lab
#define nd_symb nd_token.tk_symb
#define nd_lineno nd_token.tk_lineno
#define nd_IDF nd_token.TOK_IDF
#define nd_STR nd_token.TOK_STR
#define nd_SLE nd_token.TOK_SLE
#define nd_SLA nd_token.TOK_SLA
#define nd_INT nd_token.TOK_INT
#define nd_REL nd_token.TOK_REL
#define nd_RLA nd_token.TOK_RLA
#define nd_RIV nd_token.TOK_RIV
1988-10-26 15:21:11 +00:00
};
/* ALLOCDEF "node" 50 */
struct node *MkNode(int class, struct node *left, struct node *right, struct token *token);
struct node *MkLeaf(int class, struct token *token);
void FreeNode(register struct node *nd);
int NodeCrash(struct node *expp);
1988-10-26 15:21:11 +00:00
#define IsProcCall(lnd) ((lnd)->nd_type->tp_fund & T_ROUTINE)
#define NULLNODE ((struct node *) 0)
#endif