Compare commits
4 commits
756f85d77d
...
727a259638
Author | SHA1 | Date | |
---|---|---|---|
727a259638 | |||
6ff75a0926 | |||
8007df6853 | |||
3b73978f40 |
1 changed files with 28 additions and 0 deletions
28
src/expr.zig
Normal file
28
src/expr.zig
Normal file
|
@ -0,0 +1,28 @@
|
|||
const Token = @import("token.zig").Token;
|
||||
|
||||
pub const Binary = struct {
|
||||
left: Expr,
|
||||
operator: Token,
|
||||
right: Expr,
|
||||
};
|
||||
|
||||
pub const Grouping = struct {
|
||||
expression: Expr,
|
||||
};
|
||||
|
||||
pub const Unary = struct {
|
||||
operator: Token,
|
||||
right: Expr,
|
||||
};
|
||||
|
||||
pub const ExprType = enum {
|
||||
Binary,
|
||||
Grouping,
|
||||
Unary,
|
||||
};
|
||||
|
||||
pub const Expr = union(ExprType) {
|
||||
Binary: Binary,
|
||||
Grouping: Grouping,
|
||||
Unary: Unary,
|
||||
};
|
Loading…
Reference in a new issue