Basic Types¶
The following types are basic types of AVUnit, the other specific types is composed of them. What’s more, variables of these types will always be passed by value, i.e. they are always copied when they are used as function arguments or in assignments.
Strings¶
String: The possible values are cpmposed by string values.
Operators:
+(string merge)
The operators + is used for string merging, it’s useful when we want to name multiple agents.
BNF Defination:
stringExpr ::= string | stringExpr '+' stringExpr
string ::= inputCharacter | string inputCharacter
inputCharacter ::= letter | digit | symbol
Note
The BNF defination here is a simplified one. For the complete version, please refer to here.
Related Examples:
string0 = "lane";
string1 = "_19";
string3 = string0 + string1;
// The value of string3 is "lane_19".
Real Values¶
Real Value: The possible values are numbers.
Operators:
Arithmetic operator 1:
^(exponentiation), this operator has highest priorityArithmetic operator 2:
*,/the multiplication and division shares the second priorityArithmetic operator 3:
+,-, unary-(only for signed integers), the addition and minus has the least priority.
BNF Defination:
realValue ::= [signal] number ['.'number]
realExpr ::= <term1> | realExpr operator1 term1
term1 ::= term2 | term1 operator2 term2
term2 ::= term3 | term2 operator3 term3
term3 ::= realValue | '(' realExpr ')'
operator1 ::= + | -
operator2 ::= * | / |
operator3 ::= ^
Note
The range of Real Value is from -infinite to +infinite. Real Value can be both Integer and Float. The BNF defination here is a simplified one. For the complete version, please refer to here.
Related Examples:
a = -2;
b = 2^3;
c = (a + b)*7/3;
// The value of c is 14.
Coordinates¶
Coordinate: The possible values are vectors.
Operators:
Arithmetic operator:
+,-, the addition and minus of coordinates.
BNF Defination:
coordinate ::= '(' realExpr, realExpr [, realExpr] ')'
coordinateExpr ::= coordinate | coordinateExpr operator1 coordinate
<operator1> ::= + | -
Note
The Coordinate can be composed of two elements or three elements. The realExpr here is type of Real Value.The BNF defination here is a simplified one. For the complete version, please refer to here.
Related Examples:
coord1 = (1,2);
coord2 = (2,3) + coord1;
coord3 = (1,2,3);
coord4 = (2,3,-1) + coord3;