From 9f3edcbeea51dd8841b9d89fa7ef98f11682a1c7 Mon Sep 17 00:00:00 2001 From: Mustafa Quraish Date: Thu, 3 Feb 2022 21:01:03 -0500 Subject: Add support for basic structs Structs for now (and probably for the near future) are not allowed to be passed by value, and instead you just pass a pointer to it. Nested structs can also be defined, and they can be either anonymous, or named (in which case only the members can access the type). --- src/ast.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/ast.h') diff --git a/src/ast.h b/src/ast.h index d1e904c..af7ef65 100644 --- a/src/ast.h +++ b/src/ast.h @@ -26,6 +26,7 @@ F(OP_GT, ">") \ F(OP_GEQ, ">=") \ F(OP_ASSIGN, "=") \ + F(OP_MEMBER, ".") \ F(AST_LITERAL, "literal") \ F(AST_FUNCCALL, "Function call") \ F(AST_CONDITIONAL, "conditional expression") \ @@ -143,6 +144,12 @@ typedef struct ast_node { Node **args; int num_args; } call; + + struct { + i64 offset; + Node *expr; + bool is_ptr; + } member; }; } Node; -- cgit v1.2.3