Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include "evalexp.h"
- struct env {
- char var[8];
- int value;
- struct env *next;
- };
- int evalexpenv(struct exp *e, struct env *env) {
- return 0;
- }
- int evalexp(struct exp *e) {
- int ans = 0;
- if ((e->tag) == isvar) {
- printf("E = variable which is %s\n", (e->var));
- return ans;
- }
- if ((e->tag) == isconstant) {
- printf("E = constant which is %d\n", (e->constant));
- return (e->constant);
- }
- if ((e->tag) == isopapp) {
- if ((e->op) == isplus) {
- printf("E = operator application '+' \n");
- }
- else {
- printf("E = operator application 'x' \n");
- }
- }
- if ((e->tag) == islet) {
- printf("E = let '%s' equal to...\n", (e->bvar));
- }
- return ans;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement