From 9704fa9f34238f3786ea9a11e230805f4931ec45 Mon Sep 17 00:00:00 2001 From: "Michael D. Lowis" Date: Fri, 25 May 2018 21:48:10 -0400 Subject: [PATCH] added typedef and prototypes for data type definitions --- source/sclpl.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/source/sclpl.h b/source/sclpl.h index 9a84205..d6393e6 100644 --- a/source/sclpl.h +++ b/source/sclpl.h @@ -59,6 +59,30 @@ typedef struct { } value; } Tok; +/* Datatype Types + *****************************************************************************/ +typedef enum { + VOID, INT, UINT, ARRAY, REF, PTR, FUNC +} Kind; + +typedef struct Type { + Kind kind; + union { + struct Type* type; + ssize_t bits; + struct { + struct Type* type; + size_t count; + } array; + } value; +} Type; + +Type* IntType(ssize_t nbits); +Type* UIntType(ssize_t nbits); +Type* ArrayOf(Type* type); +Type* RefTo(Type* type); +Type* PtrTo(Type* type); + /* AST Types *****************************************************************************/ typedef enum { -- 2.54.0