From 0ddbe79d25d3eefa12987ea2e938a4707ec9daed Mon Sep 17 00:00:00 2001 From: Brandon Rozek Date: Wed, 19 Sep 2018 18:44:42 -0400 Subject: [PATCH] Modified gitignore file and added the Value Type definition. --- .gitignore | 4 +++- src/node.h | 16 ++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index e1f6e81..83c4ea0 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,6 @@ src/lex.yy.c src/parser.tab.c src/parser.tab.h sloth -vgcore* \ No newline at end of file +vgcore* +.vscode +.vscode/* \ No newline at end of file diff --git a/src/node.h b/src/node.h index 3e6efef..e607b1c 100644 --- a/src/node.h +++ b/src/node.h @@ -34,6 +34,22 @@ struct Variable { double value; }; +typedef union typeval { + long num; + double dec; +} TypeVal; + +struct Value { + int type; + TypeVal value; +}; + +// Value functions +int get_int(struct Value* val); +double get_double(struct Value* val); +void set_int(struct Value* val); +void set_double(struct Value* val); + // Variable Functions struct Variable* make_variable(char* id, double value); void set_value(struct Variable* var, double value);