Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include "trees.h"
- #include "globals.h"
- #include "symboltable.h"
- exprnode *allocate_constexpr(int value){
- exprnode *p_expr = (exprnode *) malloc(sizeof(exprnode));
- if( p_expr != NULL){
- TYPE(p_expr) = CONSTANT;
- CON_VALUE(p_expr) = VALUE;
- }
- return p_expr;
- }
- exprnode *allocate_symbolexpr(char value){
- exprnode *p_expr = (exprnode *) malloc(sizeof(exprnode));
- if(p_expr != NULL){
- TYPE(p_expr) = VARIABLE;
- SYM_VALUE(p_expr) = value;
- }
- return p_expr;
- }
- exprnode *allocate_operatorexpr(Operator value){
- exprnode *p_expr = (exprnode *) malloc(sizeof(exprnode));
- if(p_expr != NULL){
- TYPE(p_expr) = OPERATOR;
- OP_VALUE(p_expr) = value;
- }
- return p_expr;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement