Updated the project structure, and modified the Makefile to hopefully be future proof so I can freely make sub-folders in the src/ folder and not have to worry about breaking the Makefile.
This commit is contained in:
+48
@@ -0,0 +1,48 @@
|
||||
#ifndef EXPRESSION_H
|
||||
#define EXPRESSION_H
|
||||
|
||||
#include "scanner.h"
|
||||
#include <stdarg.h>
|
||||
|
||||
typedef enum {
|
||||
EXPRESSION,
|
||||
LITERAL,
|
||||
GROUPING,
|
||||
UNARY,
|
||||
BINARY,
|
||||
OPERATOR
|
||||
} ExpressionType;
|
||||
|
||||
typedef struct Expr Expr;
|
||||
|
||||
struct binary {
|
||||
struct Expr* left;
|
||||
Token* op;
|
||||
struct Expr* right;
|
||||
};
|
||||
|
||||
struct grouping {
|
||||
struct Expr* expression;
|
||||
};
|
||||
|
||||
struct unary {
|
||||
Token* op;
|
||||
struct Expr* right;
|
||||
};
|
||||
|
||||
struct Expr {
|
||||
ExpressionType type;
|
||||
union ex {
|
||||
struct binary Binary;
|
||||
struct grouping Grouping;
|
||||
Token* Literal;
|
||||
struct unary Unary;
|
||||
} expression;
|
||||
};
|
||||
|
||||
// void VisitBinary(struct binary);
|
||||
// void VisitGrouping(struct grouping);
|
||||
// void VisitLiteral(Token);
|
||||
// void VisitUnary(struct unary);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user