added update to linux

master
xerox 5 years ago
parent 56c4e0b589
commit 7e4819c544

@ -6,7 +6,6 @@
#include "y.tab.h"
void yyerror(char *);
extern YYSTYPE yylval;
extern FILE *yyin;
int yylineno;
@ -28,6 +27,8 @@
"char" { return KEYWORD_C; }
"++" { return INCREASE; }
"--" { return DECREASE; }
"<=" { return LESS_THAN_OR_EQUAL; }
">=" { return GREATER_THAN_OR_EQUAL; }
\"(\\.|[^"\\])*\" { yytext++; yytext[strlen(yytext)-1] = 0; yylval.str_ptr = strdup(yytext); return STRING; }
[a-zA-Z0-9_]+ { yylval.str_ptr = strdup(yytext); return VARNAME; }
-?[0-9]*\.[0-9]+ { yylval.double_num = atof(yytext); return DOUBLEVAR; }
@ -64,7 +65,6 @@ int main(int argc, char* argv[])
|| strcmp(argv[1],"d") == 0 || strcmp(argv[1],"debug") == 0)
{
_DEON_DEBUG = 1;
printf(">>> ");
yyparse();
}
else if (fh = fopen(argv[1], "r"))

@ -13,7 +13,6 @@
int yylex(void);
void yyerror(char *);
extern int yylineno;
%}
/* doing these before multiplication and division because they have a lower presidence */
@ -33,14 +32,21 @@ extern int yylineno;
struct node_info *node_ptr;
}
%token INCREASE PRINT_TOKEN IF END KEYWORD_S KEYWORD_I KEYWORD_C QUOTE ELSE WHILE DEF CALL
%token LESS_THAN_OR_EQUAL
%token GREATER_THAN_OR_EQUAL
%token DECREASE
%token INCREASE DECREASE PRINT_TOKEN IF END KEYWORD_S KEYWORD_I KEYWORD_C QUOTE ELSE WHILE DEF CALL
%token <int_num> INTEGER
%type <int_num> EXPR_I
%token <str_ptr> STRING VARNAME
%token <byte_num> CHAR
%token <double_num> DOUBLEVAR
%type <double_num> EXPR_D
%token <float_num> FLOAT_NUM
%type <int_num> EXPR
%type <node_ptr> STMT PRINT VARIABLE FUNC STMT_LIST LOGIC
%%
@ -51,7 +57,7 @@ PROGRAM:
;
MAIN:
MAIN FUNC ';' { if (_DEON_DEBUG == true ) { printf(">>> "); exec_stmt($2); } else { exec_stmt($2); } }
MAIN FUNC ';' { exec_stmt($2); }
|
;
@ -78,42 +84,61 @@ LOGIC:
| WHILE '[' VARNAME ']' ':' '{' STMT_LIST '}' { $$ = create_logic_node(create_logic(WHILE_LOGIC, $7, $3)); }
;
VARIABLE:
VARNAME '=' STRING { $$ = create_variable_const($1, (void *) $3, VAR_STRING);}
| VARNAME '=' EXPR { $$ = create_variable_const($1, alloc_value(&$3, VAR_INT), VAR_INT);}
| VARNAME '=' CHAR { $$ = create_variable_const($1, alloc_value(&$3, VAR_BYTE), VAR_BYTE);}
| VARNAME '=' DOUBLEVAR { $$ = create_variable_const($1, alloc_value(&$3, VAR_DOUBLE), VAR_DOUBLE);}
VARNAME '=' STRING { $$ = create_variable($1, (void *) $3, VAR_STRING);}
| VARNAME '=' EXPR_I { $$ = create_variable($1, alloc_value(&$3, VAR_INT), VAR_INT);}
| VARNAME '=' EXPR_D { $$ = create_variable($1, alloc_value(&$3, VAR_DOUBLE), VAR_DOUBLE);}
| VARNAME '=' CHAR { $$ = create_variable($1, alloc_value(&$3, VAR_BYTE), VAR_BYTE);}
| VARNAME '=' DOUBLEVAR { $$ = create_variable($1, alloc_value(&$3, VAR_DOUBLE), VAR_DOUBLE);}
| VARNAME '=' '{' STMT_LIST '}' { $$ = create_function($1, $4); }
| VARNAME '=' VARNAME { $$ = move_value($1, $3); }
;
EXPR:
EXPR_I:
INTEGER { $$ = $1; }
| EXPR '+' EXPR { $$ = $1 + $3; }
| EXPR '-' EXPR { $$ = $1 - $3; }
| EXPR '*' EXPR { $$ = $1 * $3; }
| EXPR '/' EXPR { $$ = $1 / $3; }
| EXPR '%' EXPR { $$ = $1 % $3; }
| EXPR '>' EXPR { if ($1 > $3) { $$ = 1; } else { $$ = 0;}}
| EXPR '<' EXPR { if ($1 < $3) { $$ = 1; } else { $$ = 0;}}
| INCREASE EXPR { $$ = $2 + 1; }
| EXPR INCREASE { $$ = $1 + 1; }
| DECREASE EXPR { $$ = $2 - 1; }
| EXPR DECREASE { $$ = $1 - 1; }
| '(' EXPR ')' { $$ = $2; }
| EXPR_I '+' EXPR_I { $$ = $1 + $3; }
| EXPR_I '-' EXPR_I { $$ = $1 - $3; }
| EXPR_I '*' EXPR_I { $$ = $1 * $3; }
| EXPR_I '/' EXPR_I { $$ = $1 / $3; }
| EXPR_I '%' EXPR_I { $$ = $1 % $3; }
| EXPR_I LESS_THAN_OR_EQUAL EXPR_I { $$ = $1 <= $3; }
| EXPR_I GREATER_THAN_OR_EQUAL EXPR_I { $$ = $1 >= $3; }
| EXPR_I '>' EXPR_I { $$ = $1 > $3; }
| EXPR_I '<' EXPR_I { $$ = $1 < $3; }
| INCREASE EXPR_I { $$ = $2 + 1; }
| EXPR_I INCREASE { $$ = $1 + 1; }
| DECREASE EXPR_I { $$ = $2 - 1; }
| EXPR_I DECREASE { $$ = $1 - 1; }
| '(' EXPR_I ')' { $$ = $2; }
| EXPR_I { $$ = $1; }
;
EXPR_D:
DOUBLEVAR
| EXPR_D '+' EXPR_D { $$ = $1 + $3; }
| EXPR_D '-' EXPR_D { $$ = $1 - $3; }
| EXPR_D '*' EXPR_D { $$ = $1 * $3; }
| EXPR_D '/' EXPR_D { $$ = $1 / $3; }
| EXPR_D LESS_THAN_OR_EQUAL EXPR_D { $$ = $1 <= $3; }
| EXPR_D GREATER_THAN_OR_EQUAL EXPR_D { $$ = $1 >= $3; }
| EXPR_D '>' EXPR_D { $$ = $1 > $3; }
| EXPR_D '<' EXPR_D { $$ = $1 < $3; }
| INCREASE EXPR_D { $$ = $2 + 1; }
| EXPR_D INCREASE { $$ = $1 + 1; }
| DECREASE EXPR_D { $$ = $2 - 1; }
| EXPR_D DECREASE { $$ = $1 - 1; }
| '(' EXPR_D ')' { $$ = $2; }
| EXPR_D { $$ = $1; }
;
PRINT:
VARNAME { $$ = create_print_variable($1); }
| EXPR { $$ = create_print_statement(VAR_INT, alloc_value(&$1, VAR_INT)); }
| EXPR_I { $$ = create_print_statement(VAR_INT, alloc_value(&$1, VAR_INT)); }
| STRING { $$ = create_print_statement(VAR_STRING, $1); }
;
%%
void yyerror(char *s)
{
fprintf(stderr, "Error on line %d, %s\n", yylineno, s);
}

@ -10,16 +10,11 @@
*/
static node_info* create_function(char* p_name, node_info* p_stmts)
{
node_info *new_node = malloc(sizeof(node_info));
if (!p_name || !p_stmts || !new_node)
if (!p_name || !p_stmts)
return NULL;
memset(new_node, NULL, sizeof(*new_node));
node_info *new_node = malloc(sizeof(node_info));
new_node->function_body = malloc(sizeof(node_info));
if (!new_node->function_body)
return NULL;
memset(new_node->function_body, NULL, sizeof(*new_node->function_body));
new_node->operation = FUNCTION_OPERATION;
new_node->operation_type.func = FUNCTION;
new_node->name = p_name;
@ -37,11 +32,10 @@ static node_info *create_function(char *p_name, node_info *p_stmts)
*/
static node_info* create_function_call(char* p_name)
{
node_info *new_node = malloc(sizeof(node_info));
if (!new_node || !p_name)
if (!p_name)
return NULL;
memset(new_node, NULL, sizeof(*new_node));
node_info *new_node = malloc(sizeof(node_info));
new_node->operation = FUNCTION_OPERATION;
new_node->operation_type.func = FUNCTION_CALL;
new_node->name = p_name;
@ -64,20 +58,13 @@ static node_info *create_compound_statement(node_info *new_statement_list, node_
{
statement_head = malloc(sizeof(node_info));
node_info* new_node = malloc(sizeof(node_info));
if (!new_node || !statement_head)
return NULL;
memset(statement_head, NULL, sizeof(*statement_head));
memset(new_node, NULL, sizeof(*new_node));
statement_head->statement_list = malloc(sizeof(node_info));
if (!statement_head->statement_list)
return NULL;
memset(statement_head->statement_list, NULL,
sizeof(*statement_head->statement_list));
statement_head->operation = EXEC_STMT_LIST_OPERATION;
statement_head->statement_list->operation = EXEC_STMT_LIST_OPERATION;
statement_head->statement_list->next = new_statement_list;
statement_head->next = NULL;
statement_head->statement_list->statement_list = NULL;
}
else
@ -88,12 +75,9 @@ static node_info *create_compound_statement(node_info *new_statement_list, node_
p_temp_head = p_temp_head->statement_list;
p_temp_head->statement_list = malloc(sizeof(node_info));
if (!p_temp_head->statement_list)
return NULL;
memset(p_temp_head->statement_list, NULL, sizeof(*p_temp_head->statement_list));
p_temp_head->operation = EXEC_STMT_LIST_OPERATION;
p_temp_head->statement_list->operation = EXEC_STMT_LIST_OPERATION;
p_temp_head->statement_list->next = new_statement_list;
p_temp_head->statement_list->statement_list = NULL;
}

@ -176,7 +176,8 @@ const char *map_next_(map_base_t *m, map_iter_t *iter) {
if (iter->node) {
iter->node = iter->node->next;
if (iter->node == NULL) goto nextBucket;
} else {
}
else {
nextBucket:
do {
if (++iter->bucketidx >= m->nbuckets) {

@ -12,6 +12,7 @@ static void free_linked_list(node_info *p_list)
{
if (!p_list)
return;
node_info* temp;
while (p_list->next)
{
@ -23,19 +24,19 @@ static void free_linked_list(node_info *p_list)
/*
Author: xerox
Update: 1/20/2020
Update: 5/13/2020
updates linked list.
shallow copy linked list.
*/
static node_info *copy_linked_list(node_info *p_list)
static node_info* shallow_copy_linked_list(node_info* p_list)
{
node_info* new_list = malloc(sizeof(node_info));
if (!new_list || !p_list)
if (!p_list)
return NULL;
node_info* new_list = malloc(sizeof(node_info));
new_list->next = NULL;
node_info* copy_list = new_list;
//TODO update with doubly linked list
while(p_list->next)
{
p_list = p_list->next;
@ -54,10 +55,12 @@ static void linked_list_append(node_info* p_head, node_info* new_node)
{
if (!p_head || !new_node)
return;
node_info* p_head_temp = p_head;
while (p_head->next)
p_head_temp = p_head_temp->next;
p_head->next = NULL; //sanity check
p_head->next = NULL;
p_head_temp->next = p_head;
}

@ -3,7 +3,7 @@
#include "../types.h"
static void free_linked_list(node_info *p_list);
static node_info *copy_linked_list(node_info *p_list);
static node_info *shallow_copy_linked_list(node_info *p_list);
static void linked_list_append(node_info* p_head, node_info* new_node);
static bool linked_list_remove(node_info* p_head, node_info* delete_node);
#endif

@ -8,13 +8,31 @@
*/
static logic* create_logic(logic_type type, node_info* stmt_list, char* var_name)
{
logic* new_logic = malloc(sizeof(logic));
if (!new_logic || !stmt_list || !var_name)
if (!stmt_list || !var_name)
return NULL;
memset(new_logic, NULL, sizeof(*new_logic));
logic* new_logic = malloc(sizeof(logic));
new_logic->type = type;
new_logic->condition_var = var_name;
new_logic->stmt_list = stmt_list;
return new_logic;
}
/*
Author: xerox
Updated: 1/19/2020
create logic node (logical expression)
*/
static node_info* create_logic_node(logic* logic_expr)
{
if (!logic_expr)
return NULL;
node_info* new_node = malloc(sizeof(node_info));
new_node->operation = LOGIC_OPERATION;
new_node->logical_expr = logic_expr;
new_node->statement_list = NULL;
new_node->next = NULL;
return new_node;
}

@ -2,4 +2,5 @@
#define LOGIC_H
#include "../types.h"
static logic* create_logic(logic_type type, node_info* stmt_list, char* var_name);
static node_info* create_logic_node(logic* logic_expr);
#endif

@ -1,3 +1,4 @@
echo -e "\e[31m[WARNING] if this fails to build, its because lex output a bad C file. Please put a '}' at the end of the erroring functions!\e[0m"
lex deon.l
yacc -d deon.y
gcc lex.yy.c y.tab.c -o deon
gcc lex.yy.c y.tab.c hashmap/map.c -o deon64

@ -0,0 +1,4 @@
echo -e "\e[31m[WARNING] if this fails to build, its because lex output a bad C file. Please put a '}' at the end of the erroring functions!\e[0m"
lex deon.l
yacc -d deon.y
gcc -m32 lex.yy.c y.tab.c hashmap/map.c -o deon

@ -2,72 +2,6 @@
#define PARSER_C
#include "parser.h"
/*
Author: xerox
Updated: 1/19/2020
create variable given name, value, and type.
*/
static node_info* create_variable_const(char* p_name, void* value, variable_type var_type)
{
node_info* new_node = malloc(sizeof(*new_node));
if (!new_node)
return NULL;
memset(new_node, NULL, sizeof(*new_node));
variable* new_var = make_variable(p_name, value, var_type);
if (!new_var)
return NULL;
new_node->assignment = (assignment_operation*)malloc(sizeof(assignment_operation));
if (!new_node->assignment)
return NULL;
memset(new_node->assignment, NULL, sizeof(*new_node->assignment));
new_node->operation = ASSIGNMENT_OPERATION;
new_node->operation_type.assignment = ASSIGN_FROM_CONST;
new_node->assignment->var = new_var;
return new_node;
}
/*
Author: xerox
Updated: 1/20/2020
Move value from one variable to another.
*/
static node_info* move_value(char* to, char* from)
{
node_info* new_node = (node_info *)malloc(sizeof(node_info));
if (!from || !new_node || !to)
return NULL;
memset(new_node, NULL, sizeof(*new_node));
new_node->assignment = (assignment_operation*)malloc(sizeof(*new_node->assignment));
if (!new_node->assignment)
return NULL;
memset(new_node->assignment, NULL, sizeof(*new_node->assignment));
new_node->operation = ASSIGNMENT_OPERATION;
new_node->operation_type.assignment = ASSIGN_FROM_VAR;
new_node->assignment->from = from;
new_node->assignment->to = to;
return new_node;
}
/*
Author: xerox
Updated: 1/19/2020
create logic node (logical expression)
*/
static node_info* create_logic_node(logic* logic_expr)
{
node_info* new_node = malloc(sizeof(node_info));
if (!new_node || !logic_expr)
return NULL;
memset(new_node, NULL, sizeof(*new_node));
new_node->operation = LOGIC_OPERATION;
new_node->logical_expr = logic_expr;
return new_node;
}
/*
Author: xerox
Updated: 1/20/2020
@ -89,17 +23,20 @@ static void exec_stmt(node_info *exec_node)
switch (exec_node->operation_type.assignment)
{
case ASSIGN_FROM_CONST:
add_var(exec_node->assignment->var->name, exec_node->assignment->var->value, _var_map);
add_var(
exec_node->assignment->var->name,
exec_node->assignment->var->value,
_var_map
);
break;
case ASSIGN_FROM_VAR:
add_var(exec_node->assignment->to,
get_value(exec_node->assignment->from, _var_map), _var_map);
get_value(exec_node->assignment->from, _var_map),
_var_map
);
break;
default:
;
#if DEON_DEBUGGING
printf("[error] unkown assignment operation: 0x%x", exec_node->operation_type.assignment);
#endif
break;
}
break;
case LOGIC_OPERATION:
@ -108,10 +45,12 @@ static void exec_stmt(node_info *exec_node)
{
case IF_LOGIC:
{
variable_values* p_var_values = get_value(exec_node->logical_expr->condition_var, _var_map);
if (!p_var_values)
return;
if (*(unsigned char*)p_var_values->data_ptr)
variable_values* p_var_values = get_value(
exec_node->logical_expr->condition_var,
_var_map
);
if (p_var_values && *(unsigned char*)p_var_values->data_ptr)
exec_stmt(exec_node->logical_expr->stmt_list);
break;
}
@ -120,6 +59,7 @@ static void exec_stmt(node_info *exec_node)
variable_values* p_var_values = get_value(exec_node->logical_expr->condition_var, _var_map);
if (!p_var_values)
return;
while (*(unsigned char*)p_var_values->data_ptr)
{
exec_stmt(exec_node->logical_expr->stmt_list);
@ -128,17 +68,16 @@ static void exec_stmt(node_info *exec_node)
break;
}
default:
;
#if DEON_DEBUGGING
printf("[error] unknown logic operation\n");
#endif
break;
}
break;
}
// execute statement list.
case EXEC_STMT_LIST_OPERATION:
{
if (exec_node->statement_list)
exec_node = exec_node->statement_list;
while (exec_node->next)
{
exec_node = exec_node->next;
@ -153,6 +92,7 @@ static void exec_stmt(node_info *exec_node)
{
case PRINT_CONSTANT:
{
// TODO replace with puts to add more modularity
switch (exec_node->print_expr->type)
{
case VAR_STRING:
@ -170,10 +110,7 @@ static void exec_stmt(node_info *exec_node)
case VAR_VOID: //TODO add void variable type
break;
default:
;
#if DEON_DEBUGGING
printf("[error] unable to print variable of type: 0x%x\n", exec_node->print_expr->type);
#endif
break;
}
break;
}
@ -197,18 +134,12 @@ static void exec_stmt(node_info *exec_node)
case VAR_VOID: //TODO add void variable type
break;
default:
;
#if DEON_DEBUGGING
printf("[error] unable to print variable of type: 0x%x\n", p_var->type);
#endif
break;
}
break;
}
default:
;
#if DEON_DEBUGGING
printf("[error] unknown print type: 0x%x\n", exec_node->operation_type.print);
#endif
break;
}
break;
}
@ -240,18 +171,12 @@ static void exec_stmt(node_info *exec_node)
break;
}
default:
;
#if DEON_DEBUGGING
printf("[error] unknown function operation: 0x%x\n", exec_node->operation_type.func);
#endif
break;
}
break;
}
default:
;
#if DEON_DEBUGGING
printf("[error] unknown operation: 0x%x\n", exec_node->operation);
#endif
break;
}
}
#endif

@ -2,8 +2,5 @@
#define PARSER_H
#include "../types.h"
#include "../vars/vars.h"
static node_info* create_variable_const(char* p_name, void* value, variable_type var_type);
static node_info* move_value(char* to, char* from);
static node_info* create_logic_node(logic* logic_expr);
static void exec_stmt(node_info *exec_node);
#endif

@ -11,18 +11,17 @@
static node_info* create_print_statement(variable_type operation, void* value)
{
node_info* new_print_stmt = (node_info*)malloc(sizeof(node_info));
print* new_print = malloc(sizeof(print));
if (!new_print_stmt || !new_print)
if (!value)
return NULL;
memset(new_print_stmt, NULL, sizeof(*new_print_stmt));
memset(new_print, NULL, sizeof(*new_print));
node_info* new_print_stmt = (node_info*)malloc(sizeof(node_info));
print* new_print = malloc(sizeof(print));
new_print_stmt->operation = PRINT_OPERATION;
new_print_stmt->operation_type.print = PRINT_CONSTANT;
new_print->type = operation;
new_print->value = value;
new_print_stmt->print_expr = new_print;
new_print_stmt->statement_list = NULL;
new_print_stmt->next = NULL;
return new_print_stmt;
}
@ -35,19 +34,16 @@ static node_info *create_print_statement(variable_type operation, void* value)
*/
static node_info* create_print_variable(char* var_name)
{
node_info* new_print_stmt = (node_info*)malloc(sizeof(node_info));
if (!new_print_stmt || !var_name)
if (!var_name)
return NULL;
memset(new_print_stmt, NULL, sizeof(*new_print_stmt));
node_info* new_print_stmt = (node_info*)malloc(sizeof(node_info));
new_print_stmt->var = malloc(sizeof(variable));
if (!new_print_stmt->var)
return NULL;
memset(new_print_stmt->var, NULL, sizeof(*new_print_stmt->var));
new_print_stmt->operation = PRINT_OPERATION;
new_print_stmt->operation_type.print = PRINT_VARIABLE;
new_print_stmt->var->name = var_name;
new_print_stmt->statement_list = NULL;
new_print_stmt->next = NULL;
return new_print_stmt;
}

@ -54,7 +54,7 @@ typedef enum _operation
EXEC_STMT_LIST_OPERATION,
PRINT_OPERATION,
FUNCTION_OPERATION,
};
} operation;
//--- variable value details
typedef struct _variable_values

@ -37,13 +37,11 @@ static variable_values* get_value(char *p_name, map_void_t* p_var_map)
*/
static variable* make_variable(char* p_name, void* value, variable_type var_type)
{
variable *new_var = malloc(sizeof(variable));
variable_values *new_value = malloc(sizeof(variable_values));
if (!new_var || !new_value || !p_name || !value)
if (!p_name || !value)
return NULL;
memset(new_var, NULL, sizeof(*new_var));
memset(new_value, NULL, sizeof(*new_value));
variable* new_var = malloc(sizeof(variable));
variable_values* new_value = malloc(sizeof(variable_values));
new_value->type = var_type;
new_value->data_ptr = value;
new_var->name = p_name;
@ -59,23 +57,20 @@ static variable* make_variable(char *p_name, void* value, variable_type var_type
*/
static void* alloc_value(void* value, variable_type var_type)
{
if (!value)
return NULL;
switch (var_type)
{
case VAR_INT:
{
int* p_int = (int*)malloc(sizeof(int));
if (!p_int)
return NULL;
memset(p_int, NULL, sizeof(*p_int));
int* p_int = malloc(sizeof(int));
*p_int = *(int*)value;
return p_int;
}
case VAR_SHORT:
{
short* p_short = (short*)malloc(sizeof(short));
if (!p_short)
return NULL;
memset(p_short, NULL, sizeof(*p_short));
short* p_short = malloc(sizeof(short));
*p_short = *(short*)value;
return p_short;
}
@ -84,16 +79,12 @@ static void* alloc_value(void* value, variable_type var_type)
char* p_char = malloc(sizeof(char));
if (!p_char)
return NULL;
memset(p_char, NULL, sizeof(*p_char));
*p_char = *(char*)value;
return p_char;
}
case VAR_DOUBLE:
{
double* p_double = malloc(sizeof(double));
if (!p_double)
return NULL;
memset(p_double, NULL, sizeof(*p_double));
*p_double = *(double*)value;
return p_double;
}
@ -101,4 +92,48 @@ static void* alloc_value(void* value, variable_type var_type)
return NULL;
}
}
/*
Author: xerox
Updated: 1/19/2020
create variable given name, value, and type.
*/
static node_info* create_variable(char* p_name, void* value, variable_type var_type)
{
if (!p_name || !value)
return NULL;
node_info* new_node = malloc(sizeof(node_info));
variable* new_var = make_variable(p_name, value, var_type);
new_node->assignment = malloc(sizeof(assignment_operation));
new_node->operation = ASSIGNMENT_OPERATION;
new_node->operation_type.assignment = ASSIGN_FROM_CONST;
new_node->assignment->var = new_var;
new_node->statement_list = NULL;
new_node->next = NULL;
return new_node;
}
/*
Author: xerox
Updated: 1/20/2020
Move value from one variable to another.
*/
static node_info* move_value(char* to, char* from)
{
if (!from || !to)
return NULL;
node_info* new_node = malloc(sizeof(node_info));
new_node->assignment = malloc(sizeof(*new_node->assignment));
new_node->operation = ASSIGNMENT_OPERATION;
new_node->operation_type.assignment = ASSIGN_FROM_VAR;
new_node->assignment->from = from;
new_node->assignment->to = to;
new_node->statement_list = NULL;
new_node->next = NULL;
return new_node;
}
#endif

@ -5,4 +5,6 @@ static void add_var(char* name, variable_values* values, map_void_t* p_var_map);
static variable* make_variable(char* p_name, void* value, variable_type var_type);
static variable_values* get_value(char* p_name, map_void_t* p_var_map);
static void* alloc_value(void* value, variable_type var_type);
static node_info* create_variable(char* p_name, void* value, variable_type var_type);
static node_info* move_value(char* to, char* from);
#endif

File diff suppressed because it is too large Load Diff

@ -79,7 +79,6 @@ static void* alloc_value(void* value, variable_type var_type)
char* p_char = malloc(sizeof(char));
if (!p_char)
return NULL;
memset(p_char, NULL, sizeof(*p_char));
*p_char = *(char*)value;
return p_char;
}

Loading…
Cancel
Save