2bdf6d6f5348 — Leonard Ritter a month ago
* more work on types
1 files changed, 32 insertions(+), 2 deletions(-)

M testing/test_typeschema2.sc
M testing/test_typeschema2.sc +32 -2
@@ 34,6 34,13 @@ enum TypeKind : u8
     Qualify = 7
     Typename = 8
 
+    #
+        Unknown = 0
+        Symbol = 1
+        BigFloat = 2
+        String = 3
+        Table = 4
+
 inline... intern-string (s : string)
     global interned-string = (u& s)
     interned-string

          
@@ 92,7 99,7 @@ struct ArrayType plain
 fn... array-type (element : u&Type, count : u64)
     u& (ArrayType TypeKind.Array element count)
 
-let IndexBits = 1
+let IndexBits = 4
 let MaxNodes = (1 << IndexBits)
 let IndexMask = ((1 << IndexBits) - 1)
 fn tree-levels (count)

          
@@ 100,6 107,27 @@ fn tree-levels (count)
     ? (numnodes == 0) 0
         (findmsb numnodes) + 1
 
+enum ObjectType : u64 # 3 bits
+    Empty = 0
+    None = 1 # ""
+    Boolean = 2 # "true", "false"
+    Number = 3 # sign, expn, len, bits...
+    String = 4 # string
+    Symbol = 5 # string
+    Table = 6
+    Subtable = 7
+
+@@ verify-sizeof 520
+struct USubtable plain
+    slots : (array (UPointer void) MaxNodes)
+    types : u64
+
+@@ verify-sizeof 96
+struct UTable plain
+    keys : (UPointer USubtable)
+    values : (UPointer USubtable)
+    meta : (UPointer this-type)
+
 struct UNode plain
     level : u32 = 0
     nodes : (array (UPointer this-type) MaxNodes)

          
@@ 392,6 420,8 @@ struct VM
 
     tukan types:
 
+    symbol set? (true, false)
+
     none
         # 0 byte
     boolean

          
@@ 407,7 437,7 @@ struct VM
     function
     table
         # tree or cons?
-        
+
         content:
             head: count, metatable
                 N x fields