summaryrefslogtreecommitdiff
path: root/compiler/parser
diff options
context:
space:
mode:
authorQuinn Stephens <quinn@osmora.org>2024-11-02 08:28:59 -0400
committerQuinn Stephens <quinn@osmora.org>2024-11-02 08:28:59 -0400
commit2ae50e907a7042aecb00bcff7643859d3f657895 (patch)
tree5f5edbb87a3f906a033b73a3c0315866bba32e79 /compiler/parser
parenta515dfb3b8f8e999362db7a6b52b3104c03b750a (diff)
More type parsing
Signed-off-by: Quinn Stephens <quinn@osmora.org>
Diffstat (limited to 'compiler/parser')
-rw-r--r--compiler/parser/parser.c6
-rw-r--r--compiler/parser/type.c1
2 files changed, 6 insertions, 1 deletions
diff --git a/compiler/parser/parser.c b/compiler/parser/parser.c
index aeec48b..261385b 100644
--- a/compiler/parser/parser.c
+++ b/compiler/parser/parser.c
@@ -79,6 +79,10 @@ parser_init(struct parser *ctx, char *source)
debug("Initializing parser...\n");
lexer_init(&ctx->lexer, source);
- add_builtin(ctx->types, "uint32", 4, 0);
add_builtin(ctx->types, "any", 0, 0);
+ add_builtin(ctx->types, "uint", sizeof(void*), 0);
+ add_builtin(ctx->types, "uint64", 8, 0);
+ add_builtin(ctx->types, "uint32", 4, 0);
+ add_builtin(ctx->types, "uint16", 2, 0);
+ add_builtin(ctx->types, "uint8", 1, 0);
}
diff --git a/compiler/parser/type.c b/compiler/parser/type.c
index 4ac9327..e0990c3 100644
--- a/compiler/parser/type.c
+++ b/compiler/parser/type.c
@@ -189,6 +189,7 @@ parse_struct(struct parser *ctx, struct type *typ)
}
next_token(ctx);
}
+ typ->size = off;
next_token(ctx);
return true;