Aug 13, 2022Kuina-chan

This is the language specification 3 of Kuin Programming Language, and is about operators. ## 1Kuin Operators

The operators and their precedence in Kuin are shown in Table 1-1.
When operators are used without parentheses, the operator with the lowest precedence will be calculated first. If operators with the same precedence are lined up, the operator on the left will be calculated first in the case of left join, and the operator on the right will be calculated first in the case of right join.
Each of these operators is explained in detail below.

## 2Function Call

It is an operator that calls a function (Table 2-1)。
The specification of function call is shown in Figure 2-1.
If you write multiple function calls in a single expression, the order in which the functions are called is undefined. When calling multiple functions with side effects, it is necessary to make sure that the order of calls is not affected. However, in the "&", "|", and "?(,)" operators, expressions are always evaluated in order from the left, and unnecessary expressions are skipped, so the order of function calls can be written assuming that they are called from the left.

## 3Array Reference

It is an operator that refers to the elements of an array (Table 3-1).
The specification of array reference is shown in Figure 3-1.

## 4Member Reference

It is an operator that refers to a member of a value (Table 4-1).
The specification of member reference is shown in Figure 4-1.
Members are the methods and properties of a class, as well as the built-in methods provided for each type.

## 5Cast

It is an operator that converts a value to a specified type (Table 5-1).
The specification of cast is shown in Figure 5-1.
If the type of the class you are trying to cast is a type that cannot be the class or parent class in the first place, an error will occur at compile time.
There are restrictions on the types that can be converted, as shown in Table 5-2.

## 6Binary Encoding

It is an operator that converts a value into a binary sequence of type []bit8 (Table 6-1).
The specification of binary encoding is shown in Figure 6-1.

## 7Binary Decoding

It is an operator that restores a binary sequence of type []bit8, converted by a binary encoding operator, to a value (Table 7-1).
The specification of binary decoding is shown in Figure 7-1.

## 8Power

It is an operator that calculates a to the b power (Table 8-1).
The specification of power is shown in Figure 8-1.

## 9Sign

It is an operator that represents a plus or minus sign (Table 9-1).
The specification of sign is shown in Figure 9-1.

## 10Logical Negation

It is an operator that inverts between true and false (Table 10-1).
The specification of logical negation is shown in Figure 10-1.

## 11Element Number Operator

It is an operator to get the number of elements in an array, etc. (Table 11-1).
The specification of element number operator is shown in Figure 11-1.

## 12Instance Creation

It is an operator that creates an instance of a class, etc. (Table 12-1).
The specification of instance creation is shown in Figure 12-1.
For example, writing "#[3,2]int" will return a two-dimensional array of type "[][]int" with 3 x 2 elements.

## 13Deep Copy

It is an operator that makes a deep copy of an instance (duplicating the value, not the reference) (Table 13-1).
The specification of deep copy is shown in Figure 13-1.

## 14Multiplication

It is an operator that calculates   (Table 14-1).
The specification of multiplication is shown in Figure 14-1.

## 15Division

It is an operator that calculates   (Table 15-1).
The specification of division is shown in Figure 15-1.

## 16Modulo Operation

It is an operator that calculates the remainder of   (Table 16-1).
The specification of modulo operation is shown in Figure 16-1.

It is an operator that calculates   (Table 17-1).
The specification of addition is shown in Figure 17-1.

## 18Subtraction

It is an operator that calculates   (Table 18-1).
The specification of subtraction is shown in Figure 18-1.

## 19Array Concatenation

It is an operator that concatenates two arrays (Table 19-1).
The specification of array concatenation is shown in Figure 19-1.

## 20Comparison Operator

It is an operator that compares two values (Table 20-1).
The specification of comparison operator is shown in Figure 20-1.

## 21Reference Comparison Operator

It is an operator that compares two references (Table 21-1).
The specification of reference comparison operator is shown in Figure 21-1.

## 22Type Comparison Operator

It is an operator that determines whether a class instance is of the specified class type or its parent class type (Table 22-1).
The specification of type comparison operator is shown in Figure 22-1.
Since an instance of an inherited child class can be assigned to a variable of its parent class, this operator is used to find out which type the assigned instance is of.

## 23Logical Conjunction

It is an operator that calculates logical conjunction (Table 23-1).
The specification of logical conjunction is shown in Figure 23-1.

## 24Logical Disjunction

It is an operator that calculates logical disjunction (Table 24-1).
The specification of logical disjunction is shown in Figure 24-1.

## 25Conditional Operator

It is an operator that returns a value depending on the truth of the condition (Table 25-1).
The specification of conditional operator is shown in Figure 25-1.

## 26Assignment Operator

It is an operator that assigns a value to a variable (Table 26-1).
The specification of assignment operator is shown in Figure 26-1.
1660379497enf