diff options
| author | Mustafa Quraish <[email protected]> | 2022-02-02 17:19:15 -0500 |
|---|---|---|
| committer | Mustafa Quraish <[email protected]> | 2022-02-02 17:54:31 -0500 |
| commit | 55f61417c7d3f6a2f4685e21b7e409ec23b7f41f (patch) | |
| tree | ad5d78d16f3f66046bdac74c2eade63414e55c0c /src/ast.h | |
| parent | Fix examples to include return type on main function (diff) | |
| download | cup-55f61417c7d3f6a2f4685e21b7e409ec23b7f41f.tar.xz cup-55f61417c7d3f6a2f4685e21b7e409ec23b7f41f.zip | |
Move type-related stuff to a separate file
It was getting a bit unwieldy in `parser.c`, and this will potentially
help when we start dealing with more complex type-stuff such as
casting / conversions / etc.
Diffstat (limited to 'src/ast.h')
| -rw-r--r-- | src/ast.h | 21 |
1 files changed, 1 insertions, 20 deletions
@@ -1,7 +1,7 @@ #pragma once -#include "common.h" #include "tokens.h" +#include "types.h" #define ENUM_AST_TYPES(F) \ F(OP_NEG, "neg") \ @@ -55,27 +55,8 @@ char *node_type_to_str(NodeType type); bool is_binary_op(NodeType type); bool is_unary_op(NodeType type); bool is_expression(NodeType type); - bool is_lvalue(NodeType type); -typedef enum { - TYPE_NONE, - TYPE_INT, - TYPE_PTR, -} DataType; - -char *data_type_to_str(DataType type); - -typedef struct data_type_node { - DataType type; - struct data_type_node *ptr; -} Type; - -Type *type_new(DataType type); -i64 size_for_type(Type *type); -bool type_equals(Type *a, Type *b); -void print_type_to_file(FILE *out, Type *type); - typedef struct { char *name; Type *type; |