Trying a more object oriented approach and created an 'Object' struct to have metadata for the values the interpreter works with.
This commit is contained in:
@@ -4,7 +4,17 @@
|
||||
#include "expr.h"
|
||||
#include "token.h"
|
||||
|
||||
typedef struct Object {
|
||||
TokenType instance;
|
||||
union {
|
||||
char* string;
|
||||
double number;
|
||||
int boolean;
|
||||
} value;
|
||||
} Object;
|
||||
|
||||
const void* VisitLiteralExpression(Expr*);
|
||||
void* VisitGroupingExpression(Expr*);
|
||||
void* VisitBinaryExpression(Expr*);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user