Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Appendix B: Operators and Symbols

This appendix contains a glossary of Calyxium's syntax, including operators and other symbols that appear by themselves or in the context of paths, comments, tuples, brackets.

Operators

Table B-1 contains the operators in Calyxium, an example of how the operator would appear in context, a short explanation.

Table B-1: Operators

OperatorsExampleExplanation
notnot exprlogical complement.
!=expr != exprNonequality comparison.
==expr == exprEquality comparison.
>expr > exprGreater than comparison.
<expr < exprLess than comparison.
>=expr >= exprGreater than or equal to comparison.
<=expr <= exprLess than or equal to comparison.
&&expr && exprShort-circuiting logical AND.
+expr + exprArithmetic addition.
-expr - exprArithmetic subtraction.
-- exprArithmetic negation.
*expr * exprArithmetic multiplication.
/expr / exprArithmetic division.
%expr % exprArithmetic remainder.
**expr ** exprArithmetic power.
lslexpr lsl exprLeft-shift.
lsrexpr lsr exprRight-shift.
=var = exprAssignment.
+=var += exprArithmetic addition and assignment.
-=var -= exprArithmetic subtraction and assignment.
*=var *= exprArithmetic multiplication and assignment.
/=var /= exprArithmetic division and assignment.
&=var &= exprBitwise AND and assignment.
`=var `= exprBitwise OR and assignment.
$=var $= exprBitwise XOR and assignment.
<<=var <<= exprLeft-shift and assignment.
>>=var >>= exprRight-shift and assignment.
++var++, expr++Incrementation.
--var--, expr--Decrementation.
lorexpr lor exprBitwise OR.
lxorexpr lxor exprBitwise XOR.
lnotlnot exprBitwise NOT.
landexpr land exprBitwise AND.
->pat -> exprPart of match arm syntax.
|>var |> expr, expr |> exprPasses left-hand value as input to right-hand expression.
|| patPart of match arm syntax.
!!varDereference mutable copy.
^string ^ stringString concatenation.
@array @ arrayArray concatenation.
..1..10, 1..Range operator (inclusive).
?cond ? expr : exprPart of ternary conditional operator.
:var: type, cond ? expr : expr, array[start:end]Type ascription or ternary branch separator, or slice range separator.
;expr; exprExpression separator.
.object.fieldMember access.
_match x with | _ -> ...Wildcard pattern.
,(a, b)Comma separator (lists, tuples, args).
:=var := exprMutable copy assignment.

Table B-2 shows symbols that create comments.

Table B-2: Comments

SymbolExplanation
--Line comment
-- $Inner line doc comment

Table B-3 shows the contexts in which curly braces are used.

Table B-3: Curly Brackets

ContextExplanation
{...}Block expression

Table B-3 shows the contexts in which square brackets are used.

Table B-3: Square Brackets

ContextExplanation
[...]Array literal
expr[expr]Collection indexing. Overloadable (Index)