diff options
Diffstat (limited to 'docs/type_system')
26 files changed, 111 insertions, 106 deletions
diff --git a/docs/type_system/bit.md b/docs/type_system/bit.md index 18ac6a8..11cecef 100644 --- a/docs/type_system/bit.md +++ b/docs/type_system/bit.md @@ -5,15 +5,13 @@ A sequence of bits that can fit into a general register ```text -Bit_size `alias Enum[Void; .bit_any; .bit8; .bit16; .bit32; .bit64] +SIZE_FLAGS : BIT_ANY | BIT8 | BIT16 | BIT32 | BIT64 -Bit_representation `alias Enum[Void - .numeric; .int; .int_unsiged; .int_signed; .float - .utf8; .utf16; .utf32 - .bool -] +REPRESENTATION_FLAGS : NUMERIC | INT | INT_UNSIGNED | INT_SIGNED | FLOAT | + UTF8 | UTF16 | UTF32 | + BOOL -Bit[Bit_size; Bit_representation] +Bit[[SIZE_FLAGS | REPRESENTATION_FLAGS]] ``` # Casting @@ -21,32 +19,32 @@ Bit[Bit_size; Bit_representation] # Alias ```text -Number `alias Bit[.bit_any; .numeric] +Number `alias Bit[[BIT_ANT | NUMERIC]] -Int `alias Bit[.bit_any; .int] +Int `alias Bit[[BIT_ANY | INT]] -Int_unsiged `alias Bit[.bit_any; .int_unsiged] +Int_unsiged `alias Bit[[BIT_ANY | INT_UNSIGNED]] -U8 `alias Bit[.bit8; .int_unsiged] -U16 `alias Bit[.bit16; .int_unsiged] -U32 `alias Bit[.bit32; .int_unsiged] -U64 `alias Bit[.bit64; .int_unsiged] +U8 `alias Bit[[BIT8 | INT_UNSIGNED]] +U16 `alias Bit[[BIT16 | INT_UNSIGNED]] +U32 `alias Bit[[BIT32 | INT_UNSIGNED]] +U64 `alias Bit[[BIT64 | INT_UNSIGED]] -Int_signed `alias Bit[.bit_any; .int_signed] +Int_signed `alias Bit[[BIT_ANY | INT_SIGNED]] -I8 `alias Bit[.bit8; .int_signed] -I16 `alias Bit[.bit16; .int_signed] -I32 `alias Bit[.bit32; .int_signed] -I64 `alias Bit[.bit64; .int_signed] +I8 `alias Bit[[BIT8 | INT_SIGNED]] +I16 `alias Bit[[BIT16 | INT_SIGNED]] +I32 `alias Bit[[BIT32 | INT_SIGNED]] +I64 `alias Bit[[BIT64 | INT_SIGNED]] -Float `alias Bit[.bit_any; .float] +Float `alias Bit[[BIT_ANY | FLOAT]] -F32 `alias Bit[.bit32; .float] -F64 `alias Bit[.bit64; .float] +F32 `alias Bit[[BIT32 | FLOAT]] +F64 `alias Bit[[BIT64 | FLOAT]] -Char `alias Bit[.bit32; .utf8] +Char `alias Bit[[BIT32 | UTF8]] -Bool `alias Bit[.bit8; .bool] +Bool `alias Bit[[BIT8 | BOOL]] ``` # Operators diff --git a/docs/type_system/buffer.md b/docs/type_system/buffer.md index 7e21a21..0933c8a 100644 --- a/docs/type_system/buffer.md +++ b/docs/type_system/buffer.md @@ -5,17 +5,15 @@ An sequence of bytes with unknown size and a byte representation ```text -Buffer_repesentation: Enum[Void; .type; .utf8; .utf16; .utf32] - -Buffer[Buffer_repesentation; TYPE] +Buffer[[TYPE | UTF8 | UTF16 | UTF32] TYPE] ``` # Alias ```text -String `alias Buffer[.utf8; Void] +String `alias Buffer[[UTF8] Void] -Array[Generic.T] `alias Buffer[.type; Generic.T] +Array[Generic.T] `alias Buffer[[TYPE] Generic.T] ``` # Operators diff --git a/docs/type_system/const.md b/docs/type_system/const.md index db1f683..cb9cd74 100644 --- a/docs/type_system/const.md +++ b/docs/type_system/const.md @@ -5,5 +5,5 @@ Cannot be changed or mutated ```text -Const[TYPE] +Const[[] TYPE] ``` diff --git a/docs/type_system/empty.md b/docs/type_system/empty.md index 6097711..09869d6 100644 --- a/docs/type_system/empty.md +++ b/docs/type_system/empty.md @@ -4,6 +4,10 @@ Container type can be null +```text +Empty[[] TYPE] +``` + ## Use with `Option` Union ```text diff --git a/docs/type_system/enum.md b/docs/type_system/enum.md deleted file mode 100644 index ebcaea6..0000000 --- a/docs/type_system/enum.md +++ /dev/null @@ -1,16 +0,0 @@ -# Enum - ---- - -A symbol associated with a type - -```text -Enum[TYPE; Collection[.symbol : Const[Value]]] -``` - -## Definition Example - -```text -E : Enum[I64; .a; .b; .c] -`log E // Enum[I64; .a : 0; .b : 1; .c : 2] -``` diff --git a/docs/type_system/error.md b/docs/type_system/error.md index cdcf7d6..bbf58c7 100644 --- a/docs/type_system/error.md +++ b/docs/type_system/error.md @@ -5,7 +5,11 @@ An error for reporting, the data used to create it cannot be accessed ```text -Error +Error[[]] +``` + +## Example +```text e : Error $ "This is an error" ``` diff --git a/docs/type_system/function.md b/docs/type_system/function.md index cd25254..d0fabc5 100644 --- a/docs/type_system/function.md +++ b/docs/type_system/function.md @@ -3,20 +3,15 @@ --- ```text -Function_class `alias Enum[Void - .unknown; .incomplete; .native - .task; process; .generator; .iterator; .closure; - .bound; - .regex -] - -Function[Function_class; STATE; List; RETURN_TYPE; Collection[TYPE.SYMBOL]] +KIND : UNKNOWN | INCOMPLETE | NATIVE | TASK | PROCESS | GENERATOR | ITERATOR | CLOSURE | BOUND | REGEX + +Function[[KIND] STATE; List; RETURN_TYPE; Collection[TYPE.SYMBOL]] ``` # Alias ```text -Fn[Generic.T; Collection[TYPE.SYMBOL]] `alias Function[Any; STATE; List; Generic.T; Collection[TYPE.SYMBOL]] +Fn[Generic.T; Collection[TYPE.SYMBOL]] `alias Function[[KIND]; STATE; List; Generic.T; Collection[TYPE.SYMBOL]] ``` # Inline Definition diff --git a/docs/type_system/group.md b/docs/type_system/group.md index f54de6d..83fb4a5 100644 --- a/docs/type_system/group.md +++ b/docs/type_system/group.md @@ -5,16 +5,15 @@ A sequence of different types accessed by index or a symbol mapped to an index ```text -Group_access `alias Enum[Void; .index; .symbol] -Group[Tuple_access; Collection[TYPE.SYMBOL]] +Group[[INDEX | SYMBOL] Collection[TYPE.SYMBOL]] ``` # Alias ```text -Tuple[Collection[TYPE.SYMBOL]] `alias Group[.index; Collection[TYPE.SYMBOL]] +Tuple[Collection[TYPE.SYMBOL]] `alias Group[[INDEX] Collection[TYPE.SYMBOL]] -Table[Collection[TYPE.SYMBOL]] `alias Group[.symbol; Collection[TYPE.SYMBOL]] +Table[Collection[TYPE.SYMBOL]] `alias Group[[SYMBOL] Collection[TYPE.SYMBOL]] ``` # Operators diff --git a/docs/type_system/index.md b/docs/type_system/index.md index 3601459..ae574d9 100644 --- a/docs/type_system/index.md +++ b/docs/type_system/index.md @@ -6,12 +6,28 @@ --- +# Representation + +```text +TEMPLATE[[MODIFIERS] DEFINES...;...] +``` + +## Modifiers + +A modifier is an internal setting (a bit mask or single value), cannot be set by a user + +Each template below has its own modifiers + +## Defines + +User specified + # Templates A template is an incomplete type ```text -Template[Field; ...] +Template[[] Field; ...] ``` If a field in a template is not filed, one of these are required: @@ -38,7 +54,7 @@ Denotes that a field that does not resolve to anything ## Value Templates -* #### [Enum](./enum.md) +* #### [Select](./select.md) * #### [Bit](./bit.md) @@ -66,7 +82,7 @@ Denotes that a field that does not resolve to anything * #### [Ref](./ref.md) -* #### [Gc](./gc.md) +* #### [Shared](./shared.md) ## Function Templates diff --git a/docs/type_system/list.md b/docs/type_system/list.md index 618c531..27f3a6e 100644 --- a/docs/type_system/list.md +++ b/docs/type_system/list.md @@ -3,7 +3,5 @@ --- ```text -List_class `alias Enum[Void; .statement; .define; .action; .loop; .if; .match; .mutation] - -List[List_class; Parent; SCOPE; TARGET; STATEMENTS ...] +List[[STATEMENT | DEFINE | ACTION | LOOP | IF | MATCH | MUTATION] Parent; VARS; TARGET; STATEMENTS ...] ``` diff --git a/docs/type_system/lock.md b/docs/type_system/lock.md index b3227ca..913a532 100644 --- a/docs/type_system/lock.md +++ b/docs/type_system/lock.md @@ -5,5 +5,5 @@ Prevent access to a parent while children are modifiable ```text -Lock[Name[...]; TYPE] +Lock[[] Name[...]; TYPE] ``` diff --git a/docs/type_system/map.md b/docs/type_system/map.md index 4947842..43e1291 100644 --- a/docs/type_system/map.md +++ b/docs/type_system/map.md @@ -3,7 +3,7 @@ --- ```text -Map[KEY_TYPE; VALUE_TYPE] +Map[[] KEY_TYPE; VALUE_TYPE] ``` # Alias diff --git a/docs/type_system/name.md b/docs/type_system/name.md index 1b7c82c..10a6ac3 100644 --- a/docs/type_system/name.md +++ b/docs/type_system/name.md @@ -3,7 +3,5 @@ --- ```text -Name_class `alias Enum[Void; .unknown; .is_type; .alias_type; .unique_type] - -Name[Name_class; TYPE; NAME_IDENTIFIER] +Name[[UNKNOWN | IS_TYPE | ALIAS_TYPE | UNIQUE_TYPE] TYPE; NAME_IDENTIFIER] ``` diff --git a/docs/type_system/namespace.md b/docs/type_system/namespace.md index 8879db4..9243280 100644 --- a/docs/type_system/namespace.md +++ b/docs/type_system/namespace.md @@ -3,8 +3,7 @@ --- ```text -Namespace_class `alias Enum[Void; .native; .file] -Namespace[Namespace_class; NAMESPACE_IDENTIFIER] +Namespace[[NATIVE | FILE] NAMESPACE_IDENTIFIER] ``` A file with code diff --git a/docs/type_system/native.md b/docs/type_system/native.md index 64f0cc9..875314f 100644 --- a/docs/type_system/native.md +++ b/docs/type_system/native.md @@ -5,7 +5,7 @@ A representation of a native object ```text -Native[INTERFACE_TABLE_POINTER] +Native[[] INTERFACE_TABLE_POINTER] ``` ## Alias diff --git a/docs/type_system/op.md b/docs/type_system/op.md index 6280cc9..198d73f 100644 --- a/docs/type_system/op.md +++ b/docs/type_system/op.md @@ -3,7 +3,7 @@ --- ```text -Op_class `alias Enum[Void; .loop; .if; .match; .mutation; .selection; ...] - -Op[Op_class; RETURN_TYPE; LEFT_TYPE; RIGHT_TYPE] +Op[[OP_NAME] RETURN_TYPE; LEFT_TYPE; RIGHT_TYPE] ``` + +The `OP_NAME` a single value diff --git a/docs/type_system/overload.md b/docs/type_system/overload.md index 341a533..602871f 100644 --- a/docs/type_system/overload.md +++ b/docs/type_system/overload.md @@ -5,7 +5,7 @@ List of complete functions, selected by signature ```text -Overload[Collection[Function[]]] +Overload[[] Collection[Function[]]] ``` ## Example diff --git a/docs/type_system/queue.md b/docs/type_system/queue.md index bd7a0c4..0a15d36 100644 --- a/docs/type_system/queue.md +++ b/docs/type_system/queue.md @@ -3,7 +3,7 @@ --- ```text -Queue[TYPE] +Queue[[] TYPE] ``` # Operators diff --git a/docs/type_system/ref.md b/docs/type_system/ref.md index a5541c3..a856e72 100644 --- a/docs/type_system/ref.md +++ b/docs/type_system/ref.md @@ -3,7 +3,7 @@ --- ```text -Ref[TYPE] +Ref[[] TYPE] ``` A reference, cannot be assigned diff --git a/docs/type_system/select.md b/docs/type_system/select.md new file mode 100644 index 0000000..b2f8f61 --- /dev/null +++ b/docs/type_system/select.md @@ -0,0 +1,24 @@ +# Select + +--- + +A symbol associated with a type + +```text +Select[[SINGLE | MULTIPLE] Type; Collection[.symbol : Const[Value]]] +``` + +# Alias + +```text +Enum[Generic.T; Collection[.symbol : Const[Value]]] `alias Select[[SINGLE]; Generic.T; Collection[.symbol : Const[Value]]] + +Mask[Generic.T; Collection[.symbol : Const[Value]]] `alias Select[[MULTIPLE]; Generic.T; Collection[.symbol : Const[Value]]] +``` + +## Definition Example + +```text +E : Enum[I64; .a; .b; .c] +`log E // Enum[I64; .a : 0; .b : 1; .c : 2] +``` diff --git a/docs/type_system/gc.md b/docs/type_system/shared.md index 3fcf88e..db8e6dc 100644 --- a/docs/type_system/gc.md +++ b/docs/type_system/shared.md @@ -1,22 +1,14 @@ -# Gc +# Shared --- Hold multiple references to the same object ```text -Gc[Type; GC_FLAGS] +Shared[[LOCK] Type] ``` -# Alias - -```text -Shared[Generic.T] `alias Gc[Generic.T; GC_FLAGS] -``` - -## `GC_FLAGS` - -### Lock Mutex +### `LOCK` The shared type has been detected across asynchronous tasks and needs to lock the mutex on mutation diff --git a/docs/type_system/symbol.md b/docs/type_system/symbol.md index cb0fc11..7906852 100644 --- a/docs/type_system/symbol.md +++ b/docs/type_system/symbol.md @@ -3,5 +3,5 @@ --- ```text -Symbol[TARGET; TYPE; NAME_IDENTIFIER] +Symbol[[] TARGET; TYPE; NAME_IDENTIFIER] ``` diff --git a/docs/type_system/task.md b/docs/type_system/task.md index e0d9db3..2cb0a4d 100644 --- a/docs/type_system/task.md +++ b/docs/type_system/task.md @@ -5,7 +5,7 @@ A segment of code assigned to a process, task code can be recursive ```text -Task[TYPE] +Task[[] TYPE] ``` ## \`await diff --git a/docs/type_system/union.md b/docs/type_system/union.md index 2c985e0..6682967 100644 --- a/docs/type_system/union.md +++ b/docs/type_system/union.md @@ -3,15 +3,13 @@ --- ```text -Union_class `alias Enum[Void; .container; .transient] - -Union[Union_class; Collection[TYPE.SYMBOL]] +Union[CONTAINER | TRANSIENT] Collection[TYPE.SYMBOL]] ``` # Alias ```text -Tag[Collection[TYPE.SYMBOL]] `alias Union[.container; Collection[TYPE.SYMBOL]] +Tag[Collection[TYPE.SYMBOL]] `alias Union[[CONTAINER] Collection[TYPE.SYMBOL]] ``` ## Tag Example @@ -36,15 +34,15 @@ Can only be retuned from functions and operations. The inner value must be moved ## Alias ```text -Result[Generic.T] `alias Union[.transient; Generic.T.value; Error.error] +Result[Generic.T] `alias Union[[TRANSIENT] Generic.T.value; Error.error] -Option[Generic.T] `alias Union[.transient; Generic.T.some; Void.none] +Option[Generic.T] `alias Union[[TRANSIENT] Generic.T.some; Void.none] -Next[Generic.T] `alias Union[.transient; Generic.T.iter; Void.done] +Next[Generic.T] `alias Union[[TRANSIENT] Generic.T.iter; Void.done] -Next_result[Generic.T] `alias Union[.transient; Generic.T.value; Error.error; Void.done] +Next_result[Generic.T] `alias Union[[TRANSIENT] Generic.T.value; Error.error; Void.done] -Next_option[Generic.T] `alias Union[.transient; Generic.T.some; Void.none; Void.done] +Next_option[Generic.T] `alias Union[[TRANSIENT] Generic.T.some; Void.none; Void.done] ``` ## Default Operation diff --git a/docs/type_system/value.md b/docs/type_system/value.md index 53807ba..683b1f2 100644 --- a/docs/type_system/value.md +++ b/docs/type_system/value.md @@ -3,5 +3,5 @@ --- ```text -Value[TYPE; DATA] +Value[[] TYPE; DATA] ``` diff --git a/docs/type_system/var.md b/docs/type_system/var.md index 737263e..206b890 100644 --- a/docs/type_system/var.md +++ b/docs/type_system/var.md @@ -3,7 +3,5 @@ --- ```text -Var_class `alias Enum[Void; .arg; .local; .loop; .if; .match; .mutate] - -Var[Var_class; TYPE; Parent; VAR_IDENTIFIER] +Var[[ARG | LOCAL | LOOP | IF | MATCH | MUTATE] TYPE; Parent; VAR_IDENTIFIER] ``` |
