aboutsummaryrefslogtreecommitdiff
path: root/src/types.h
diff options
context:
space:
mode:
authorMustafa Quraish <[email protected]>2022-02-02 19:22:15 -0500
committerMustafa Quraish <[email protected]>2022-02-02 19:22:15 -0500
commite2dbc82213a6e5da74de2220eeeab78da41fb519 (patch)
tree7f6d9a40fde00ec761e100a92bd93f555725d56c /src/types.h
parentMove type-related stuff to a separate file (diff)
downloadcup-e2dbc82213a6e5da74de2220eeeab78da41fb519.tar.xz
cup-e2dbc82213a6e5da74de2220eeeab78da41fb519.zip
Add initial support for arrays (also no testing)
Usual disclaimer at this point: Quick&Dirty implementation, hasn't been tested other than basic sanity checks. Arrays are automatically decayed into pointers when the identifier is accessed.
Diffstat (limited to 'src/types.h')
-rw-r--r--src/types.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/types.h b/src/types.h
index 5f6f45a..8bbf4e3 100644
--- a/src/types.h
+++ b/src/types.h
@@ -7,11 +7,13 @@ typedef enum {
TYPE_NONE,
TYPE_INT,
TYPE_PTR,
+ TYPE_ARRAY,
} DataType;
typedef struct data_type_node {
DataType type;
struct data_type_node *ptr;
+ i64 array_size;
} Type;
Type *type_new(DataType type);
@@ -23,4 +25,6 @@ char *type_to_str(Type *type);
typedef struct ast_node Node;
Node *handle_unary_expr_types(Node *, Token *);
-Node *handle_binary_expr_types(Node *, Token *); \ No newline at end of file
+Node *handle_binary_expr_types(Node *, Token *);
+
+Node *decay_array_to_pointer(Node *, Token *); \ No newline at end of file