Files
clox/expr.h
T

47 lines
682 B
C

#ifndef EXPRESSION_H
#define EXPRESSION_H
#include "scanner.h"
typedef enum {
EXPRESSION,
LITERAL,
GROUPING,
UNARY,
BINARY,
OPERATOR
} ExpressionType;
typedef struct Expr expression;
struct binary {
Expr* left;
TokenType op;
Expr* right;
};
struct grouping {
Expr* expression;
};
struct literal {
TokenType type; //Probably something to this effect.
void* object;
};
struct unary {
TokenType op;
Expr* right;
};
struct Expr {
ExpressionType type;
union ex {
struct binary Binary;
struct grouping Grouping;
struct literal Literal;
struct unary Unary;
} expression;
};
#endif