Added untested parser code, meaning most of chapter 6 has been implemented (but most likely, very poorly).

This commit is contained in:
2022-02-28 20:13:59 +00:00
parent b72645aed0
commit 41a04094e2
6 changed files with 217 additions and 8 deletions
+13 -8
View File
@@ -12,26 +12,26 @@ typedef enum {
OPERATOR
} ExpressionType;
typedef struct Expr expression;
typedef struct Expr Expr;
struct binary {
Expr* left;
TokenType op;
Expr* right;
struct Expr* left;
Token* op;
struct Expr* right;
};
struct grouping {
Expr* expression;
struct Expr* expression;
};
struct literal {
TokenType type; //Probably something to this effect.
Token* type;
void* object;
};
struct unary {
TokenType op;
Expr* right;
Token* op;
struct Expr* right;
};
struct Expr {
@@ -44,4 +44,9 @@ struct Expr {
} expression;
};
void VisitBinary(struct binary);
void VisitGrouping(struct grouping);
void VisitLiteral(struct literal);
void VisitUnary(struct unary);
#endif