Compare commits

...

4 commits

Author SHA1 Message Date
727a259638 rm make_exprs.py, moving to the c part 2019-06-01 00:04:04 -03:00
6ff75a0926 finish make_exprs.py script
- add src/expr.zig
2019-05-31 23:43:46 -03:00
8007df6853 add mypy_cache to gitignore 2019-05-31 23:38:21 -03:00
3b73978f40 add make_exprs.py script 2019-05-31 23:37:45 -03:00

28
src/expr.zig Normal file
View 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,
};