1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
Reference list of syntax elements
=================================
Space and new line characters (actually all characters identified as white
spaces by isspace()) are lexical separators.
+----------+-----------+---------+---------------------------------------------+
| Element | Usage | Returns | Meaning |
+----------+-----------+---------+---------------------------------------------+
| a | a | a | Variable a. the regular expression |
| | | | [a-zA-Z_][a-zA-Z0-9_]* applies to names. |
+----------+-----------+---------+---------------------------------------------+
| v | v | v | Temporary object of value v. It is unnamed |
| | | | and exists only within the expression, |
| | | | which is ended by ), ], , ; or ,. |
| | | | Values can be integers ([0-9]+), rationals |
| | | | (([0-9]+\.[0-9]*|[0-9]*\.[0-9]+)), or |
| | | | matrices, described with operator []. |
| | | | Values can be used wherever a variable is |
| | | | used except as the lvalue of an assignment. |
| | | | A value is considered to exist when used. |
+----------+-----------+---------+---------------------------------------------+
| = | a = b | a | Store the value of b in a. b must exist. a |
| | | | is created if it didn't exist. |
+----------+-----------+---------+---------------------------------------------+
| + | a + b | a + b | Create a temporary object of value a + b. a |
| - | a + b | a - b | and b must exist. The same applies to |
| | | | a - b. If both a and b are integers, the |
| | | | result is an integer. If one of them is an |
| | | | integer or a rational and the other is a |
| | | | rational, the result is a rational. If one |
| | | | of them is a matrix, the result is a |
| | | | matrix. |
+----------+-----------+---------+---------------------------------------------+
| + | +a | a | Create a temporary object of value a or -a. |
| - | -a | -a | a must exist. |
+----------+-----------+---------+---------------------------------------------+
| * | a * b | a * b | Create a temporary object of value a * b. a |
| | | | and b must exist. The same rules as for the |
| | | | + and - operators apply concerning the type |
| | | | of the result. |
+----------+-----------+---------+---------------------------------------------+
| / | a / b | a / b | Create a temporary object of value a / b. a |
| | | | and b must exist. If a and b are integers |
| | | | or rationals (possibly mixing the two |
| | | | types), the result is a rational. If a is a |
| | | | matrix, the result is a matrix. It is not |
| | | | possible to divide by a matrix. |
+----------+-----------+---------+---------------------------------------------+
| += | a += b | a | a = a + b |
| -= | a -= b | a | a = a - b |
| *= | a *= b | a | a = a * b |
| /= | a /= b | a | a = a / b |
| | | | All comments concerning operators =, +, -, |
| | | | * and / apply. |
+----------+-----------+---------+---------------------------------------------+
| () | f(args) | f(args) | Call builtin function f with args. The |
| | | | result is a temporary object. Function |
| | | | names follow the same restrictions as |
| | | | variable names. Parameters are separated |
| | | | by commas. |
+----------+-----------+---------+---------------------------------------------+
| () | (expr) | expr | Evaluate an expression and return the value |
| | | | of the expression, which may be a temporary |
| | | | object or a variable. |
+----------+-----------+---------+---------------------------------------------+
| [] | [vals] | [vals] | Create a temporary matrix object. Rows are |
| | | | separated by ; whereas values are separated |
| | | | by ,. Values can only be rationals. Integer |
| | | | values will be converted automatically. |
| | | | Example : a = [1, 2; 3, 4] creates a 2x2 |
| | | | square matrix of value |
| | | | (1 2) |
| | | | (3 4) |
+----------+-----------+---------+---------------------------------------------+
| , | expr, | N/A | When not used as parameter separator or |
| ; | expr; | N/A | value/row separator, these operators |
| | | | are expression separators. ; prevents |
| | | | result to be displayed. |
+----------+-----------+---------+---------------------------------------------+
|