Download Ox Appendices

Transcript
A6.4 Objects
escape-sequence: one of
\"
double quote (")
\0
null character
\a or \g alert (bel)
\f
formfeed
\r
carriage return
\v
vertical tab
\xhh
hexadecimal number (hh)
\ooo
decimal number
131
\’
\\
\b
\n or \l
\t
\e
single quote (’)
backslash (\)
backspace
newline
horizontal tab
escape (ASCII 27)
At least one and at most two hexadecimal digits must be given for the hexadecimal
escape sequence. A single quote need not be escaped.
A6.3.6 Constant expression
A constant-expression∗4 is an expression which involves scalar constants and the following operators: + - * /.
An int-constant-expression is a constant expression which evaluates to an integer.
Constant expressions are evaluated when the code is compiled.
A6.4 Objects
A6.4.1 Types
Variables in OxGauss are implicitly typed, and can change type during their lifetime.
The life of a variable corresponds to the level of its declaration. Its scope is the section
of the program in which it can be seen. Scope and life do not have to coincide.
There are three basic types and four derived types. The integer type int is a signed
integer. The double precision floating point type is called double. A matrix is a twodimensional array of doubles which can be manipulated as a whole. A string-type holds
a string, while an array-type is an array of references. A function is also recognized as
a type.
arithmetic-type:
string-type:
scalar-type:
vector-type:
derived-type:
other-type:
int, double, matrix
string
int, double
string, matrix
string-array, character-matrix
function
At the programming level, the following types are used in external declarations:
4
Where OxGauss allows constant-expressions, Gauss only allows constants.