Added untested parser code, meaning most of chapter 6 has been implemented (but most likely, very poorly).
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user