]> git.mdlowis.com Git - proto/sclpl.git/commitdiff
added typedef and prototypes for data type definitions
authorMichael D. Lowis <mike@mdlowis.com>
Sat, 26 May 2018 01:48:10 +0000 (21:48 -0400)
committerMichael D. Lowis <mike@mdlowis.com>
Sat, 26 May 2018 01:48:10 +0000 (21:48 -0400)
source/sclpl.h

index 9a84205a05b381c3a3aaed6671367da693b6f98e..d6393e6a7eb623ee710da52db72cbb8ddcccbf74 100644 (file)
@@ -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 {