Advertisement
Guest User

Untitled

a guest
Aug 16th, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include "trees.h"
  4. #include "globals.h"
  5. #include "symboltable.h"
  6.  
  7.  
  8. exprnode *allocate_constexpr(int value){
  9. exprnode *p_expr = (exprnode *) malloc(sizeof(exprnode));
  10.  
  11. if( p_expr != NULL){
  12. TYPE(p_expr) = CONSTANT;
  13. CON_VALUE(p_expr) = VALUE;
  14. }
  15. return p_expr;
  16. }
  17.  
  18. exprnode *allocate_symbolexpr(char value){
  19. exprnode *p_expr = (exprnode *) malloc(sizeof(exprnode));
  20.  
  21. if(p_expr != NULL){
  22. TYPE(p_expr) = VARIABLE;
  23. SYM_VALUE(p_expr) = value;
  24. }
  25. return p_expr;
  26. }
  27.  
  28. exprnode *allocate_operatorexpr(Operator value){
  29. exprnode *p_expr = (exprnode *) malloc(sizeof(exprnode));
  30.  
  31. if(p_expr != NULL){
  32. TYPE(p_expr) = OPERATOR;
  33. OP_VALUE(p_expr) = value;
  34. }
  35. return p_expr;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement