diff --git a/expr.h b/expr.h index 7d9ac4e..283e900 100644 --- a/expr.h +++ b/expr.h @@ -4,41 +4,44 @@ #include "scanner.h" typedef enum { - Expression, - Literal, - Grouping, - Unary, - Binary, - Operator + EXPRESSION, + LITERAL, + GROUPING, + UNARY, + BINARY, + OPERATOR } ExpressionType; -typedef struct { - ExpressionType type; - union ex { - struct binary; - struct grouping; - struct literal; - struct unary; - } expression; -} Expr; +typedef struct Expr expression; -typedef struct { - Expr left; +struct binary { + Expr* left; TokenType op; - Expr right; -} binary; + Expr* right; +}; struct grouping { - Expr expression; + Expr* expression; }; struct literal { - char* object; + TokenType type; //Probably something to this effect. + void* object; }; struct unary { TokenType op; - Expr right; + Expr* right; +}; + +struct Expr { + ExpressionType type; + union ex { + struct binary Binary; + struct grouping Grouping; + struct literal Literal; + struct unary Unary; + } expression; }; #endif \ No newline at end of file