Cicada ---> Online Help Docs ---> Reference
Operators and reserved words
- , or line break : demarcate commands
- ( ... ) : group terms in an expression
- X~ : ignore output of expression X
- | : single-line comment
- |* ... *| : multiple-line comment
- & : continue command on next line
Numeric operators:
- x + y : addition
- x - y : subtraction
- x * y : multiplication
- x / y : division
- x ^ y : raise to a power
- i mod j : modulo (integer only)
Boolean operators:
- A == B : if equal
- A ==@ B : if same reference
- A /= B : if not equal
- A /=@ B : if different reference
- A >= B : if greater than or equal to
- A > B : if greater than
- A <= B : if less than or equal to
- A < B : if less than
- A and B : if A and B (both arguments are always evaluated)
- A or B : if A or B or both (both arguments are always evaluated)
- A xor B : if A or B, but not both
- not A : true only if A is false
Member/array operators:
- A.B : step from A into member B
- [ A ] : step into array index A
- [< A, B >] : step into array indices A through B
- [^ N ] : resize array to given size N, step into all indices 1-N
- [+ A ] : insert index
- [+< A, B >] : insert indices
- [*] or [] : step to all indices; can resize before = or =!
- remove A or [- A ] or [-< A, B >] : remove member, array index A or indices A through B
Define/equate operators:
- A :: B : define A (member with a variable) with the type of the variable that B points to
- A = B or A <- B : copy data from B to A
- A := B : define A to type B, copy data from B to A
- A =@ B or A <- @ B : make A an alias of B
- A :=@ B : define A and make it an alias of B
- A @:: B : define A to be of type B (variable type only)
- A *:: B : define A to be of type B (member type only)
- A =! B or A <- ! B : copy data from B to A; even between dissimilar data types
Predefined variables:
- this : the function currently executing
- parent or \ : the next function up the search path
- that : variable on the left side of an equate
- args : the argument variable to the function currently executing
- top : within array brackets, the number of indices
- nothing or * : the void
Program flow:
- if A then ..., else if B then ..., else ... : do if A, B, etc. are true
- while A do ..., : do as long as A is true
- loop ... until A : do until A is true
- for I in < A, B > ... : do for a defined number of times
- backfor I in < B, A > ... : same as for, except starts at B and counts backwards to A
- A( ... ) : call A as a function with given arguments
- code or ; : begin a new code block
- return A or return : exit function with return variable A (if specified)
- exit : exit Cicada
Data types:
- bool : Boolean
- char : character
- int : integer
- double : floating point
- string : string of characters
- '...' : inlined character constant (one character only)
- "..." : inlined string containing given characters
- { ... } : inlined function, set, class or data type
- A : B : an inherited type specialized by B from parent type A
- A << B : the code/type of B substituted into the variable space of A
- A # B : the Bth code block of variable A
Last update: May 8, 2024