blob: cbbd51856474151618737e3dd0a523eed8a108a2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
#include <stdio.h>
#include <string.h>
typedef struct term {
short select;
union {
struct term **children;
int int_val;
char *string_val;
} term_body;
} term;
term *true();
term *false();
term *numeral(int i);
term *variable(char *s);
char *variable_name(term *t);
int numeral_value(term *t);
term *variable_list(term *i1, term *i2);
term *greater(term *i1, term *i2);
term *addition(term *i1, term *i2);
term *skip();
term *assignment(term *i1, term *i2);
term *sequence(term *i1, term *i2);
term *term_while(term *i1, term *i2);
term *variable_value(term *i1, term *i2);
term *child(term *t, int rank);
term *lookup(term *env, char *var);
term *update(term *env, char *var_name, term *val);
term *evaluate(term *env, term *exp);
term *execute(term *env, term *inst);
|