Skip to content

Commit

Permalink
Add logical NOT operator to spec, semi-finalize SymAttr, remove symkind
Browse files Browse the repository at this point in the history
  • Loading branch information
cetio committed May 8, 2024
1 parent 3582b20 commit cbb54f4
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 58 deletions.
125 changes: 70 additions & 55 deletions rt/metadata.fn
Original file line number Diff line number Diff line change
@@ -1,59 +1,74 @@
module rt.metadata;

public const tagged SymKind : ^short
public const tagged SymAttr : ^long
{
Type = 1 << 0;
Struct = 1 << 1;
Class = 1 << 2;
Tagged = 1 << 3;
Tuple = 1 << 4;

Function = 1 << 5;
Delegate = 1 << 6;
Lambda = 1 << 7;
Ctor = 1 << 8;
Dtor = 1 << 9;
Unittest = 1 << 16;

Field = 1 << 10;
Local = 1 << 11;
Parameter = 1 << 12;

Expression = 1 << 13;
Literal = 1 << 14;
}

public const tagged SymAttributes : ^int
{
Array = 1 << 0;
Dynamic_Array = 1 << 1;
Static_Array = 1 << 2;
Assoc_Array = 1 << 3;

Integral = 1 << 4;
Scalar = 1 << 5;
Floating = 1 << 6;
String = 1 << 7;
Signed = 1 << 8;
Reference = 1 << 9;

Heap_Storage = 1 << 10;
Stack_Storage = 1 << 11;
Scalar_Storage = 1 << 12;
Float_Storage = 1 << 13;
XMM_Storage = 1 << 14;
YMM_Storage = 1 << 15;
ZMM_Storage = 1 << 16;

Public = 1 << 17;
Private = 1 << 18;
Internal = 1 << 19;

Trusted = 1 << 20;
System = 1 << 21;
Safe = 1 << 22;

Abstract = 1 << 23;
Static = 1 << 24;
Bitfield = 1 << 25;
// Top-Level Kind
TYPE = 1 << 0;
STRUCT = 1 << 1;
CLASS = 1 << 2;
TAGGED = 1 << 3;
TUPLE = 1 << 4;
MODULE = 1 << 5;

FUNCTION = 1 << 5;
DELEGATE = 1 << 6;
LAMBDA = 1 << 7;
CTOR = 1 << 8;
DTOR = 1 << 9;
UNITTEST = 1 << 10;

FIELD = 1 << 11;
LOCAL = 1 << 12;
PARAMETER = 1 << 13;

EXPRESSION = 1 << 14;
LITERAL = 1 << 15;

// Attributes
PUBLIC = 1 << 16;
PRIVATE = 1 << 17;
INTERNAL = 1 << 18;

SAFE = 1 << 19;
SYSTEM = 1 << 20;
TRUSTED = 1 << 21;

STATIC = 1 << 22;
// NOT thread-local storage.
GLOBAL = 1 << 23;
// Non-temporal.
TRANSIENT = 1 << 24;
ATOMIC = 1 << 25;
BITFIELD = 1 << 26;
PURE = 1 << 36;
CONST = 1 << 37;
REF = 1 << 38;

KIND_HEAP = 1 << 27;
KIND_STACK = 1 << 28;
KIND_SCALAR = 1 << 29;
KIND_FLOAT = 1 << 30;
KIND_XMM = 1 << 31;
KIND_YMM = 1 << 32;
KIND_ZMM = 1 << 33;
KIND_READONLY = 1 << 34;
KIND_DEFAULT = 1 << 35;

ARRAY = 1 << 39;
DYNARRAY = 1 << 40;
// Static array.
FIXARRAY = 1 << 41;
// Associative array.
ASOARRAY = 1 << 42;

STRING = 1 << 43;
WSTRING = 1 << 44;
DSTRING = 1 << 45;
BYTE = 1 << 46;
WORD = 1 << 47;
DWORD = 1 << 48;
QWORD = 1 << 49;
FLOAT = 1 << 50;
DOUBLE = 1 << 51;
SIGNED = 1 << 52;
}
2 changes: 1 addition & 1 deletion spec/grammar.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ Operators are a builtin part of the language used to perform certain operations.
| `<\|` | Downcast operator, downcasts data to its superior type. |
| `>` `<` `<=` `>=` | Comparison operators, special behavior is defined for array types, which return a mask of where the comparison returned true. |
| `+` `-` `*` `/` `%` `^^` `<<` `>>` `<<<` `^` `&` `\|` `~` `in` | Binary operators. `in` is used for checking if an associative array contains an element, and `~` is used for array concatenation by default. |
| `==` `!=` `&&` `\|\|` | Equality operators. |
| `==` `!=` `&&` `\|\|`, `!` | Equality and logical operators, with `!` and `!=` as NOT operators. |
| `[..]` | Slicing operator, defined to return a slice of elements from a range by default, using a given lower and or upper bounds or the entire range is returned. |
| `[x]` | Indexing operator, used for range interfaces by default. |
| `--` `++` `~` `-` | Unary postdecrement, postincrement, not, and neg operators. Postdecrement and postincrement may appear as preX versions in which they are after a variable. |
Expand Down
3 changes: 1 addition & 2 deletions spec/metadata.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
| `attributes` | All attributes of the given symbol. | All |
| `children` | Children of the given symbol. | All |
| `parents` | Parents of the given symbol. | All |
| `symkind` | The kind of symbol that the given symbol is. | All |
| `symattr` | The symbol attributes of the given symbol is, this is ***not*** the same as `attributes`. | All |
| `symattr` | The symbol attributes of the given symbol has, this is ***not*** the same as `attributes`. | All |
| `sizeof` | The size of the given symbol's data. | Variables, Types, Functions |
| `alignof` | The alignment of the given symbol's data. | Variables, Types, Functions |
| `typeof` | The type of the given symbol's data. | Variables, Types |
Expand Down

0 comments on commit cbb54f4

Please sign in to comment.