1987-03-10 11:49:39 +00:00
|
|
|
/* $Header$ */
|
1987-03-09 16:02:32 +00:00
|
|
|
/*
|
|
|
|
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
|
|
|
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
|
|
|
*/
|
1987-02-24 17:05:53 +00:00
|
|
|
#define E_NODE 0
|
|
|
|
#define E_VAR 1 /* Variable *or* channel */
|
|
|
|
#define E_CONST 2
|
|
|
|
#define E_TABLE 3
|
|
|
|
#define E_BTAB 4
|
|
|
|
#define E_NOW 5
|
|
|
|
#define E_IO 6
|
|
|
|
#define E_CALL 7
|
|
|
|
|
|
|
|
struct table {
|
|
|
|
struct table *next;
|
1987-03-18 09:29:56 +00:00
|
|
|
long val;
|
1987-02-24 17:05:53 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct expr;
|
|
|
|
|
|
|
|
struct expr_list {
|
|
|
|
struct expr_list *next;
|
1987-03-18 09:29:56 +00:00
|
|
|
struct expr *arg;
|
1987-02-24 17:05:53 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct expr {
|
|
|
|
short kind;
|
|
|
|
short type;
|
|
|
|
int arr_siz;
|
|
|
|
union {
|
|
|
|
struct {
|
|
|
|
int op;
|
|
|
|
struct expr *left, *right;
|
|
|
|
} node;
|
|
|
|
|
|
|
|
struct symbol *var;
|
|
|
|
|
1991-12-03 10:52:03 +00:00
|
|
|
long cst;
|
1987-02-24 17:05:53 +00:00
|
|
|
|
|
|
|
int tab;
|
|
|
|
|
|
|
|
struct {
|
|
|
|
int out;
|
|
|
|
struct expr *chan;
|
|
|
|
struct expr_list *args;
|
|
|
|
} io;
|
|
|
|
|
|
|
|
struct {
|
1987-03-18 09:29:56 +00:00
|
|
|
struct expr *c_proc;
|
|
|
|
struct expr_list *c_args;
|
1987-02-24 17:05:53 +00:00
|
|
|
} call;
|
|
|
|
} u;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct expr *new_node(), *new_var(), *new_const(), *new_table(), *new_now();
|
|
|
|
struct expr *new_io(), *new_call(), *copy_const();
|
|
|
|
void table_add(), expr_list_add();
|
|
|
|
void check_param(), check_io(), check_wait();
|
|
|
|
void destroy(), used();
|
|
|
|
|
|
|
|
#define valueless(e) (((e)->type&T_TYPE)==T_VOID)
|
|
|
|
#define valued(e) (((e)->type&T_TYPE)==T_VALUE)
|
|
|
|
#define input_process(e) ((e)->kind==E_IO && !(e)->u.io.out)
|
|
|
|
#define constant(e) ((e)->kind==E_CONST)
|
|
|
|
#define arr_constant(e) ((e)->kind==E_TABLE || (e)->kind==E_BTAB)
|