Advertisement
Guest User

Untitled

a guest
Feb 20th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #include "evalexp.h"
  5.  
  6. struct env {
  7. char var[8];
  8. int value;
  9. struct env *next;
  10. };
  11.  
  12. int evalexpenv(struct exp *e, struct env *env) {
  13. return 0;
  14. }
  15.  
  16. int evalexp(struct exp *e) {
  17. int ans = 0;
  18. if ((e->tag) == isvar) {
  19. printf("E = variable which is %s\n", (e->var));
  20. return ans;
  21. }
  22. if ((e->tag) == isconstant) {
  23. printf("E = constant which is %d\n", (e->constant));
  24. return (e->constant);
  25. }
  26. if ((e->tag) == isopapp) {
  27. if ((e->op) == isplus) {
  28. printf("E = operator application '+' \n");
  29. }
  30. else {
  31. printf("E = operator application 'x' \n");
  32. }
  33.  
  34.  
  35.  
  36. }
  37. if ((e->tag) == islet) {
  38. printf("E = let '%s' equal to...\n", (e->bvar));
  39. }
  40. return ans;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement