diff --git a/src/operations/node.c b/src/operations/node.c index 01c71e9..191e3e1 100644 --- a/src/operations/node.c +++ b/src/operations/node.c @@ -14,7 +14,7 @@ struct Node* make_node(int type, struct Value* value, char* id) { int i; /* allocate space */ - struct Node* node = malloc(sizeof(struct Node)); + struct Node* node = (struct Node*) malloc(sizeof(struct Node)); /* set properties */ node->type = type; diff --git a/src/parser/parser.y b/src/parser/parser.y index e6fcbff..a9d7313 100644 --- a/src/parser/parser.y +++ b/src/parser/parser.y @@ -44,7 +44,7 @@ %token COMMENT %token WHITESPACE %token DONE -%token LAMBDA +%token LAMBDATAG %token COLON /* declare non-terminals */ @@ -101,9 +101,9 @@ statements: BEGINTOK substatements END { $$ = $2; } substatements: statement substatements {$$ = make_node(STATEMENT, NULL, ""); attach_node($$, $1); attach_node($$, $2); } | statement {$$ = make_node(STATEMENT, NULL, ""); attach_node($$, $1); } -exprlambda: LAMBDA ident COLON expression { +exprlambda: LAMBDATAG ident COLON expression { // Only supports one argument functions for now - $$ = make_node(LAMBDA, NULL, ""); + $$ = make_node(LAMBDATAG, NULL, ""); attach_node($$, $2); attach_node($$, $4); } | expression { $$ = $1; } diff --git a/src/variables/environment.c b/src/variables/environment.c index db0411e..f89c0b3 100644 --- a/src/variables/environment.c +++ b/src/variables/environment.c @@ -5,7 +5,7 @@ #include "variable.h" struct Environment* create_environment(void) { - struct Environment* env = malloc(sizeof(struct Environment)); + struct Environment* env = (struct Environment*) malloc(sizeof(struct Environment)); env->num_vars = 0; for(int i = 0; i < MAX_VARIABLES; i++) { env->vars[i] = NULL; diff --git a/src/variables/value.c b/src/variables/value.c index 383ff7e..b63c44e 100644 --- a/src/variables/value.c +++ b/src/variables/value.c @@ -6,7 +6,7 @@ struct Value* make_value(int type, long num, double dec, struct Node* expr, char* str) { /* allocate space */ - struct Value* val = malloc(sizeof(struct Value)); + struct Value* val = (struct Value*) malloc(sizeof(struct Value)); /* set properties */ val->type = type; diff --git a/src/variables/value.h b/src/variables/value.h index eb63cbb..4167813 100644 --- a/src/variables/value.h +++ b/src/variables/value.h @@ -1,7 +1,7 @@ #ifndef VALUE_H #define VALUE_H -enum TypeTag { DOUBLE, LONG, BOOLEAN, STRING }; +enum TypeTag { DOUBLE, LONG, BOOLEAN, STRING, LAMBDA }; typedef union typeval { long num; diff --git a/src/variables/variable.c b/src/variables/variable.c index 2ab5275..60a3951 100644 --- a/src/variables/variable.c +++ b/src/variables/variable.c @@ -6,7 +6,7 @@ /* creates a new variable and returns it */ struct Variable* make_variable(char* id, struct Value* value) { /* allocate space */ - struct Variable* var = malloc(sizeof(struct Variable)); + struct Variable* var = (struct Variable*) malloc(sizeof(struct Variable)); /* set properties */ strcpy(var->id, id);