From: Michael D. Lowis Date: Sat, 26 May 2018 01:48:10 +0000 (-0400) Subject: added typedef and prototypes for data type definitions X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=9704fa9f34238f3786ea9a11e230805f4931ec45;p=proto%2Fsclpl.git added typedef and prototypes for data type definitions --- 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 {