en fr

Sysquake Pro – Table of Contents

Sysquake – Table of Contents

Sysquake for LaTeX – Table of Contents

LME Reference

This chapter describes LME (Lightweight Math Engine), the interpreter for numeric computing used by Sysquake.

Program format

Statements

An LME program, or a code fragment typed at a command line, is composed of statements. A statement can be either a simple expression, a variable assignment, or a programming construct. Statements are separated by commas, semicolons, or end of lines. The end of line has the same meaning as a comma, unless the line ends with a semicolon. When simple expressions and assignments are followed by a comma (or an end of line), the result is displayed to the standard output; when they are followed by a semicolon, no output is produced. What follows programming constructs does not matter.

When typed at the command line, the result of simple expressions is assigned to the variable ans; this makes easy reusing intermediate results in successive expressions.

Continuation characters

A statement can span over several lines, provided all the lines but the last one end with three dots. For example,

1 + ...
2

is equivalent to 1 + 2. After the three dots, the remaining of the line, as well as empty lines and lines which contain only spaces, are ignored.

Inside parenthesis or braces, line breaks are permitted even if they are not escaped by three dots. Inside brackets, line breaks are matrix row separators, like semicolons, unless they follow a comma or a semicolon where they are ignored.

Comments

Unless when it is part of a string enclosed between single ticks, a single percent character or two slash characters mark the beginning of a comment, which continues until the end of the line and is ignored by LME. Comments must follow continuation characters, if any.

a = 2;    % comment at the end of a line
x = 5;    // another comment
% comment spanning the whole line
b = ...   % comment after the continuation characters
    a;
a = 3%   no need to put spaces before the percent sign
s = '%';  % percent characters in a string

Comments may also be enclosed between /* and */; in that case, they can span several lines.

Pragmas

Pragmas are directives for the LME compiler. They can be placed at the same location as LME statements, i.e. in separate lines or between semicolons or commas. They have the following syntax:

_pragma name arguments

where name is the pragma name and arguments are additional data whose meaning depends on the pragma.

Currently, only one pragma is defined. Pragmas with unknown names are ignored.

NameArgumentsEffect
linen Set the current line number to n

_pragma line 120 sets the current line number as reported by error messages or used by the debugger or profiler to 120. This can be useful when the LME source code has been generated by processing another file, and line numbers displayed in error messages should refer to the original file.

Function Call

Functions are fragments of code which can use input arguments as parameters and produce output arguments as results. They can be built in LME (built-in functions), loaded from optional extensions, or defined with LME statements (user functions).

A function call is the action of executing a function, maybe with input and/or output arguments. LME supports different syntaxes.

fun
fun()
fun(in1)
fun(in1, in2,...)
out1 = fun...
(out1, out2, ...) = fun...
[out1, out2, ...] = fun...
[out1 out2 ...] = fun...

Input arguments are enclosed between parenthesis. They are passed to the called function by value, which means that they cannot be modified by the called function. When a function is called without any input argument, parenthesis may be omitted.

Output arguments are assigned to variables or part of variables (structure field, list element, or array element). A single output argument is specified on the left on an equal character. Several output arguments must be enclosed between parenthesis or square brackets (arguments can simply be separated by spaces when they are enclosed in brackets). Parenthesis and square brackets are equivalent as far as LME is concerned; parenthesis are preferred in LME code, but square brackets are available for compatibility with third-party applications.

Output arguments can be discarded without assigning them to variables either by providing a shorter list of variables if the arguments to be discarded are at the end, or by replacing their name with a tilde character. For example to get the index of the maximum value in a vector and to discard the value itself:

(~, index) = max([2, 1, 5, 3]);

Named input arguments

Input arguments are usually recognized by their position. Some functions also differentiate them by their data type. This can lead to code which is difficult to write and to maintain. A third method to distinguish the input arguments of a function is to tag them with a name, with a syntax similar to an assignment. Named arguments must follow unnamed arguments.

fun(1, [2,3], dim=2, order=1);

For some functions, named arguments are an alternative to a sequence of unnamed arguments.

Command syntax

When a function has only literal character strings as input arguments, a simpler syntax can be used. The following conditions must be satisfied:

  • No output argument.
  • Each input argument must be a literal string
    • without any space, tabulator, comma or semicolon,
    • beginning with a letter, a digit or one of '-/.:*' (minus, slash, dot, colon, or star),
    • containing at least one letter or digit.

In that case, the following syntax is accepted; left and right columns are equivalent.

CommandFunction
fun str1fun('str1')
fun str1 str2   fun('str1','str2')
fun abc,def   fun('abc'),def

Arguments can also be quoted strings; in that case, they may contain spaces, tabulators, commas, semicolons, and escape sequences beginning with a backslash (see below for a description of the string data type). Quoted and unquoted arguments can be mixed:

fun 'a bc\n'fun('a bc\n')
fun str1 'str 2'   fun('str1','str 2')

The command syntax is especially useful for functions which accept well-known options represented as strings, such as format loose.

Libraries

Libraries are collections of user functions, identified in LME by a name. Typically, they are stored in a file whose name is the library name with a ".lml" suffix (for instance, library stdlib is stored in file "stdlib.lml"). Before a user function can be called, its library must be loaded with the use statement. use statements have an effect only in the context where they are placed, i.e. in a library, or the command-line interface, or a Sysquake SQ file; this way, different libraries may define functions with the same name provided they are not used in the same context.

In a library, functions can be public or private. Public functions may be called from any context which use the library, while private functions are visible only from the library they are defined in.

Types

Numerical, logical, and character arrays

The basic type of LME is the two-dimensional array, or matrix. Scalar numbers and row or column vectors are special kinds of matrices. Arrays with more than two dimensions are also supported. All elements have the same type, which are described in the table below. Two non-numeric types exist for character arrays and logical (boolean) arrays. Cell arrays, which contain composite types, are described in a section below.

TypeDescription
double64-bit IEEE number
complex doubleTwo 64-bit IEEE numbers
single32-bit IEEE number
complex singleTwo 32-bit IEEE numbers
uint3232-bit unsigned integer
int3232-bit signed integer
uint1616-bit unsigned integer
int1616-bit signed integer
uint88-bit unsigned integer
int88-bit signed integer
uint6464-bit unsigned integer
int6464-bit signed integer

64-bit integer numbers are not supported by all applications on all platforms.

These basic types can be used to represent many mathematic objects:

Scalar
One-by-one matrix.
Vector
n-by-one or one-by-n matrix. Functions which return vectors usually give a column vector, i.e. n-by-one.
Empty object
0-by-0 matrix (0-by-n or n-by-0 matrices are always converted to 0-by-0 matrices).
Polynomial of degree d
1-by-(d+1) vector containing the coefficients of the polynomial of degree d, highest power first.
List of n polynomials of same degree d
n-by-(d+1) matrix containing the coefficients of the polynomials, highest power at left.
List of n roots
n-by-1 matrix.
List of n roots for m polynomials of same degree n
n-by-m matrix.
Single index
One-by-one matrix.
List of indices
Any kind of matrix; the real part of each element taken row by row is used.
Sets
Numerical array, or list or cell array of strings (see below).
Boolean value
One-by-one logical array; 0 means false, and any other value (including nan) means true (comparison and logical operators and functions return logical values). In programs and expressions, constant boolean values are entered as false and true. Scalar boolean values are displayed as false or true; in arrays, respectively as F or T.
String
Usually 1-by-n char array, but any shape of char arrays are also accepted by most functions.

Unless a conversion function is used explicitly, numbers are represented by double or complex values. Most mathematical functions accept as input any type of numeric value and convert them to double; they return a real or complex value according to their mathematical definition.

Basic element-wise arithmetic and comparison operators accept directly integer types ("element-wise" means the operators + - .* ./ .\ and the functions mod and rem, as well as operators * / \ with a scalar multiplicand or divisor). If their arguments do not have the same type, they are converted to the size of the largest argument size, in the following order:

double > single > uint64 > int64 > uint32 > int32 > uint16 > int16 > uint8 > int8

Literal two-dimensional arrays are enclosed in brackets. Rows are separated with semicolons or line breaks, and row elements with commas or spaces. Here are three different ways to write the same 2-by-3 double array.

A = [1, 2, 3; 4, 5, 6];
A = [1 2 3
 4 5 6];
A = [1, 2,
3;
4, 5 6];

Functions which manipulate arrays (such as reshape which changes their size or repmat which replicates them) preserve their type.

To convert arrays to numeric, char, or logical arrays, use functions + (unary operator), char, or logical respectively. To convert the numeric types, use functions double, single, or uint8 and similar functions.

Numbers

Double and complex numbers are stored as floating-point numbers, whose finite accuracy depends on the number magnitude. During computations, round-off errors can accumulate and lead to visible artifacts; for example, 2-sqrt(2)*sqrt(2), which is mathematically 0, yields -4.4409e-16. Integers whose absolute value is smaller than 2^52 (about 4.5e15) have an exact representation, though.

Literal double numbers (constant numbers given by their numeric value) have an optional sign, an integer part, an optional fractional part following a dot, and an optional exponent. The exponent is the power of ten which multiplies the number; it is made of the letter 'e' or 'E' followed by an optional sign and an integer number. Numbers too large to be represented by the floating-point format are changed to plus or minus infinity; too small numbers are changed to 0. Here are some examples (numbers on the same line are equivalent):

123 +123 123. 123.00 12300e-2 
-2.5 -25e-1 -0.25e1 -0.25e+1
0 0.0 -0 1e-99999
inf 1e999999
-inf -1e999999

Literal integer numbers may also be expressed in hexadecimal with prefix 0x, in octal with prefix 0, or in binary with prefix 0b. The four literals below all represent 11, stored as double:

0xb
013
0b1011
11

Literal integer numbers stored as integers and literal single numbers are followed by a suffix to specify their type, such as 2int16 for the number 2 stored as a two-byte signed number or 0x300uint32 for the number whose decimal representation is 768 stored as a four-byte unsigned number. All the integer types are valid, as well as single. This syntax gives the same result as the call to the corresponding function (e.g. 2int16 is the same as int16(2)), except when the integer number cannot be represented with a double; then the number is rounded to the nearest value which can be represented with a double. Compare the expressions below:

ExpressionValue
uint64(123456789012345678)123456789012345696
123456789012345678uint64123456789012345678

Literal complex numbers are written as the sum or difference of a real number and an imaginary number. Literal imaginary numbers are written as double numbers with an i or j suffix, like 2i, 3.7e5j, or 0xffj. Functions i and j can also be used when there are no variables of the same name, but should be avoided for safety reasons.

The suffices for single and imaginary can be combined as isingle or jsingle, in this order only:

2jsingle
3single + 4isingle

Command format is used to specify how numbers are displayed.

Strings

Strings are stored as arrays (usually row vectors) of 16-bit unsigned numbers. Literal strings are enclosed in single quotes:

'Example of string'
''

The second string is empty. For special characters, the following escape sequences are recognized:

CharacterEscape seq.Character code
Null\00
Bell\a7
Backspace\b8
Horizontal tab\t9
Line feed\n10
Vertical tab\v11
Form feed\f12
Carriage return\r13
Single tick\'39
Single tick'' (two ')39
Backslash\\92
Hexadecimal number\xhhhh
Octal number\oooooo
16-bit UTF-16\uhhhh1 UTF-16 code
21-bit UTF-32\Uhhhhhhhh1 or 2 UTF-16 codes

For octal and hexadecimal representations, up to 3 (octal) or 2 (hexadecimal) digits are decoded; the first non-octal or non-hexadecimal digit marks the end of the sequence. The null character can conveniently be encoded with its octal representation, \0, provided it is not followed by octal digits (it should be written \000 in that case). It is an error when another character is found after the backslash. Single ticks can be represented either by a backslash followed by a single tick, or by two single ticks.

Depending on the application and the operating system, strings can contain directly Unicode characters encoded as UTF-8, or MBCS (multibyte character sequences). 16-bit characters encoded with \uhhhh escape sequences are always accepted and handled correctly by all built-in LME functions (low-level input/output to files and devices which are byte-oriented is an exception; explicit UTF-8 conversion should be performed if necessary).

UTF-32 sequences \Uhhhhhhhh assume UTF-16 encoding. In sequences \uhhhh and \Uhhhhhhhh, up to 4 or 8 hexadecimal digits can be provided, respectively, but the first non-hexadecimal character marks the end of the sequence.

Inline data

For large amounts of text or binary data, the syntax described above is impractical. Inline data is a special syntax for storing strings as raw text or uint8 arrays as base64.

Strings (char arrays of dimension 1-by-n) can be defined in the source code as raw text without any escape sequence with the following syntax:

@/text marker
text
marker

where @/text is that literal sequence of six characters followed or not by spaces and tabs, marker is an arbitrary sequence of characters without spaces, tabs or end-of-lines which does not occur in the text, and text is the text itself. The spaces, tabs and first end-of-line which follow the first marker are ignored. The last marker must be at the beginning of a line; this means that the string always ends with an end-of-line. The whole text inline data is equivalent to a string with the corresponding characters and can be located in an assignment or any expression. End-of-line sequences (\n, \r or \r\n) are replaced by a single linefeed character.

Here is an example of a short fragment of C code, assigned to variable src. The sequence \n is not interpreted as an escape sequence by LME; it results in the two characters \ and n in src. The trailing semicolon suppresses the display of the assignment, like in any LME expression.

src = @/text"""
int main() {
  printf("Hello, data!\n");
}
""";

Arrays of uint8, of dimension n-by-1 (column vectors), can be defined in the source code in a compact way using the base64 encoding in inline data:

@/base64 data

where @/base64 is that literal sequence of eight characters, followed by spaces and/or line breaks, and the data encoded with base64 (see RFC 2045). The base64-encoded data can contain lowercase and uppercase letters a-z and A-Z, digits 0-9, and characters / (slash) and + (plus), and is followed by 0, 1 or 2 characters = (equal) for padding. Spaces, tabs and line breaks are ignored. Comments are not allowed.

The first character which is not a valid base64 character signals the end of the inline data and the beginning of the next token of source code. Inline data can be a part of any expression, assignment or function call, like any other literal value. In the case where the inline data is followed by a character which would erroneously be interpreted as more base64 codes (e.g. neither padding with = nor statement terminator and a keyword at the beginning of the following line), it should be enclosed in parenthesis.

Inline data can be generated with the base64encode function. For example, to encode uint8(0:255).' as inline data, you can evaluate

base64encode(uint8(0:255))

Then copy and paste the result to the source code, for instance as follows to set a variable d (note how the semicolon will be interpreted as the delimiter following the inline data, not the data iteself):

d = @/base64
AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKiss
LS4vMDEyMzQ1Njc4OTo7PD0+P0BBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZ
WltcXV5fYGFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6e3x9fn+AgYKDhIWG
h4iJiouMjY6PkJGSk5SVlpeYmZqbnJ2en6ChoqOkpaanqKmqq6ytrq+wsbKz
tLW2t7i5uru8vb6/wMHCw8TFxsfIycrLzM3Oz9DR0tPU1dbX2Nna29zd3t/g
4eLj5OXm5+jp6uvs7e7v8PHy8/T19vf4+fr7/P3+/w== ;

Lists and cell arrays

Lists are ordered sets of other elements. They may be made of any type, including lists. Literal lists are enclosed in braces; elements are separated with commas.

{1,[3,6;2,9],'abc',{1,'xx'}}

Lists can be empty:

{}

List's purpose is to collect any kind of data which can be assigned to variables or passed as arguments to functions.

Cell arrays are arrays whose elements (or cells) contain data of any type. They differ from lists only by having more than one dimension. Most functions which expect lists also accept cell arrays; functions which expect cell arrays treat lists of n elements as 1-by-n cell arrays.

To create a cell array with 2 dimensions, cells are written between braces, where rows are separated with semicolons and row elements with commas:

{1, 'abc'; 27, true}

Since the use of braces without semicolon produces a list, there is no direct way to create a cell array with a single row, or an empty cell array. Most of the time, this is not a problem since lists are accepted where cell arrays are expected. To force the creation of a cell array, the reshape function can be used:

reshape({'ab', 'cde'}, 1, 2)

Structures

Like lists and cell arrays, structures are sets of data of any type. While list elements are ordered but unnamed, structure elements, called fields, have a name which is used to access them.

There are three ways to make structures: with field assignment syntax inside braces, with the struct function, or by setting each field in an assignment. s.f refers to the value of the field named f in the structure s. Usually, s is the name of a variable; but unless it is in the left part of an assignment, it can be any expression which evaluates to a structure.

a = {label = 'A', position = [2, 3]};

b = struct(name = 'Sysquake',
           os = {'Windows', 'macOS', 'Linux'});

c.x = 200;
c.y = 280;
c.radius = 90;

d.s = c;

With the assignments above, a.os{3} is 'Linux' and c.s.radius is 90.

While the primary way to access structure fields is by name, field order is still preserved, as can be seen by displaying the strcture, getting the field names with fieldnames, or converting the structure to a cell array with struct2cell. The fields can be reordered with orderfields.

Structure arrays

While structure fields can contain any type of array and cell arrays can have structures stored in their cells, structure arrays are arrays where each element has the same named fields. Plain structures are structure arrays of size [1,1], like scalar numbers are arrays of size [1,1].

Values are specified first by indices between parenthesis, then by field name. Braces are invalid to access elements of structure arrays (they can be used to access elements of cell arrays stored in structure array fields).

Structure arrays are created from cell arrays with functions structarray or cell2struct, or by assigning values to fields.

A = structarray('name', {'dog','cat'},
                'weight', {[3,100],[3,18]});

B = cell2struct({'dog','cat';[3,100],[3,18]},
                {'name','weight'});

C(1,1).name = 'dog';
C(1,1).weight = [3,100];
C(1,2).name = 'cat';
C(1,2).weight = [3,18];

Column struct arrays (1-dimension) can be defined with field assignments inside braces by separating array elements with semicolons. Missing fields are set to the empty array [].

D = {a = 1, b = 2; a = 5, b = 3; b = 8};

Value sequences

Value sequences are usually written as values separated with commas. They are used as function input arguments or row elements in arrays or lists.

When expressions involving lists, cell arrays or structure arrays evaluate to multiple values, these values are considered as a value sequence, or part of a value sequence, and used as such in context where value sequences are expected. The number of values can be known only at execution time, and may be zero.

L = {1, 2};
v = [L{:}];  // convert L to a row vector
c = complex(L{:});  // convert L to a complex number

Value sequences can arise from element access of list or cell arrays with brace indexing, or from structure arrays with field access with or without parenthesis indexing.

Function references

Function references are equivalent to the name of a function together with the context in which they are created. Their main use is as argument to other functions. They are obtained with operator @.

Inline and anonymous functions

Inline and anonymous functions encapsulate executable code. They differ only in the way they are created: inline functions are made with function inline, while anonymous functions have special syntax and semantics where the values of variables in the current context can be captured implicitly without being listed as argument. Their main use is as argument to other functions.

Sets

Sets are represented with numeric arrays of any type (integer, real or complex double or single, character, or logical), or lists or cell arrays of strings. Members correspond to an element of the array or list. All set-related functions accept sets with multiple values, which are always reduced to unique values with function unique. They implement membership test, union, intersection, difference, and exclusive or. Numerical sets can be mixed; the result has the same type as when mixing numeric types in array concatenation. Numerical sets and list or cell arrays os strings cannot be mixed.

Null

Null stands for the lack of data. It is both a data type and the only value it can represent. It can be assigned to a variable, be contained in a list or cell array element or a structure field, or passed as an input or output argument to/from a function.

Null is a recent addition to LME, where the lack of data is usually represented by the empty matrix []. It is especially useful when LME is interfaced with languages or libraries where the null value has a special meaning, such as SQL (Structured Query Language, used with relational databases) or the DOM (Document Object Model, used with XML).

Objects

Objects are the basis of Object-Oriented Programming (OOP), an approach of programming which puts the emphasis on encapsulated data with a known programmatic interface (the objects). Two OOP languages in common use today are C++ and Java.

The exact definition of OOP varies from person to person. Here is what it means when it relates to LME:

Data encapsulation
Objects contain data, but the data cannot be accessed directly from the outside. All accesses are performed via special functions, called methods. What links a particular method to a particular object is a class. Class are identified with a name. When an object is created, its class name is specified. The names of methods able to act on objects of a particular class are prefixed with the class name followed with two colons. Objects are special structures whose contents are accessible only to its methods.
Function and operator overloading
Methods may have the same name as regular functions. When LME has to call a function, it first checks the type of the input arguments. If one of them is an object, the corresponding method is called, rather than the function defined for non-object arguments. A method which has the same name as a function or another method is said to overload it. User functions as well as built-in ones can be overloaded. Operators which have a function name (for instance x+y can also be written plus(x,y)) can also be overloaded. Special functions, called object constructors, have the same name as the class and create new objects. They are also methods of the class, even if their input arguments are not necessarily objects.
Inheritance
A class (subclass) may extend the data and methods of another class (base class or parent). It is said to inherit from the parent. In LME, objects from a subclass contain in a special field an object of the parent class; the field name has the same name as the parent class. If LME does not find a method for an object, it tries to find one for its parent, great-parent, etc. if any. An object can also inherit from several parents.

Here is an example of the use of polynom objects, which (as can be guessed from their name) contain polynomials. Statement use polynom imports the definitions of methods for class polynom and others.

use polynom;
p = polynom([1,5,0,1])
  p =
    x^3+5x^2+1
q = p^2 + 3 * p / polynom([1,0])
  q =
    x^6+10x^5+25x^4+2x^3+13x^2+15x+1

Input and Output

LME identifies channels for input and output with non-negative integer numbers called file descriptors. File descriptors correspond to files, devices such as serial port, network connections, etc. They are used as input argument by most functions related to input and output, such as fprintf for formatted data output or fgets for reading a line of text.

Note that the description below applies to most LME applications. For some of them, files, command prompts, or standard input are irrelevant or disabled; and standard output does not always correspond to the screen.

At least four file descriptors are predefined:

ValueInput/OutputPurpose
0InputStandard input from keyboard
1OutputStandard output to screen
2OutputStandard error to screen
3OutputPrompt for commands

You can use these file descriptors without calling any opening function first, and you cannot close them. For instance, to display the value of pi, you can use fprintf:

fprintf(1, 'pi = %.6f\n', pi);
  pi = 3.141593

Some functions use implicitly one of these file descriptors. For instance disp displays a value to file descriptor 1, and warning displays a warning message to file descriptor 2.

File descriptors for files and devices are obtained with specific functions. For instance fopen is used for reading from or writing to a file. These functions have as input arguments values which specify what to open and how (file name, host name on a network, input or output mode, etc.), and as output argument a file descriptor. Such file descriptors are valid until a call to fclose, which closes the file or the connection.

Error Messages

When an error occurs, the execution is interrupted and an error message explaining what happened is displayed, unless the code is enclosed in a try/catch block. The whole error message can look like

> use stat
> iqr(123)

Index out of range for variable 'M' (stat/prctile;61)
-> stat/iqr;69

The first line contains an error message, the location in the source code where the error occurred, and the name of the function or operator involved. Here stat is the library name, prctile is the function name, and 61 is the line number in the file which contains the library. If the function where the error occurs is called itself by another function, the whole chain of calls is displayed; here, prctile was called by iqr at line 69 in library stat.

Here is the list of errors which can occur. For some of them, LME attempts to solve the problem itself, e.g. by allocating more memory for the task.

Stack overflow
Too complex expression, or too many nested function calls.
Data stack overflow
Too large objects on the stack (in expressions or in nested function calls).
Variable overflow
Not enough space to store the contents of a variable.
Code overflow
Not enough memory for compiling the program.
Not enough memory
Not enough memory for an operation outside the LME core.
Algorithm does not converge
A numeric algorithm does not converge to a solution, or does not converge quickly enough. This usually means that the input arguments have invalid values or are ill-conditioned.
Incompatible size
Size of the arguments of an operator or a function do not agree together.
Bad size
Size of the arguments of a function are invalid.
Non-vector array
A row or column vector was expected, but a more general array was found.
Not a column vector
A column vector was expected, but a more general array was found.
Not a row vector
A row vector was expected, but a more general array was found.
Non-matrix array
A matrix was expected, but an array with more than 2 dimensions was found.
Non-square matrix
A square matrix was expected, but a rectangular matrix was found.
Index out of range
Index negative or larger than the size of the array.
Wrong type
String or complex array instead of real, etc.
Non-integer argument
An argument has a fractional part while an integer is required.
Non positive integer argument
An argument is not a positive integer as expected.
Argument out of range
An argument is outside the permitted range of values.
Non-scalar argument
An argument is an array while a scalar number is required.
Non-object argument
An object is required as argument.
Not a permutation
The argument is not a permutation of the integers from 1 to n.
Bad argument
A numeric argument has the wrong site or the wrong value.
Unknown option
A string option has an invalid value.
Object too large
An object has a size larger than some fixed limit.
Undefined variable
Attempt to retrieve the contents of a variable which has not been defined.
Undefined input argument
Attempt to retrieve the contents of an input argument which was neither provided by the caller nor defined in the function.
Undefined function
Attempt to call a function not defined.
Too few or too many input arguments
Less or more arguments in the call than what the function accepts.
Too few or too many output arguments
Less or more left-side variables in an assignment than the function can return.
Syntax error
Unspecified compile-time error.
"function" keyword without function name
Incomplete function header.
Bad function header
Syntax error in a function header
Missing expression
Statement such as if or while without expression.
Unexpected expression
Statement such as end or else followed by an expression.
Incomplete expression
Additional elements were expected during the compilation of an expression, such as right parenthesis or a sub-expression at the right of an operator.
"for" not followed by a single assignment
for is followed by an expression or an assignment with multiple variables.
Bad variable name
The left-hand part of an assignment is not a valid variable name (e.g. 2=3)
String without right quote
The left quote of a string was found, but the right quote is missing.
Unknown escape character sequence
In a string, the backslash character is not followed by a valid escape sequence.
Unexpected right parenthesis
Right parenthesis which does not match a left parenthesis.
Unexpected right bracket
Right bracket which does not match a left bracket.
Unrecognized or unexpected token
An unexpected character was found during compilation (such as (1+))
"end" not in an index expression
end was used outside of any index sub-expression in an expression.
"beginning" not in an index expression
beginning was used outside of any index sub-expression in an expression.
"matrixcol" not in an index expression
matrixcol was used outside of any index sub-expression in an expression.
"matrixrow" not in an index expression
matrixrow was used outside of any index sub-expression in an expression.
"matrixrow" or "matrixcol" used in the wrong index
matrixrow was used in an index which was not the first one, or matrixcol was used in an index which was not the only one or the second one.
Compilation overflow
Not enough memory during compilation.
Too many nested subexpressions
The number of nested of subexpressions is too high.
Variable table overflow
A single statement attempts to define too many new variables at once.
Expression too large
Not enough memory to compile a large expression.
Too many nested (), [] and {}
The maximum depth of nested subexpressions, function argument lists, arrays and lists is reached.
Too many nested programming constructs
Not enough memory to compile that many nested programming constructs such as if, while, switch, etc.
Wrong number of input arguments
Too few or too many input arguments for a built-in function during compilation.
Wrong number of output arguments
Too few or too many output arguments for a built-in function during compilation.
Too many indices
More than two indices for a variable.
Variable not found
A variable is referenced, but appears neither in the arguments of the function nor in the left part of an assignment.
Unbounded language construct
if, while, for, switch, or try without end.
Unexpected "end"
The end statement does not match an if, switch, while, for, or catch block.
"case" or "otherwise" without "switch"
The case or otherwise statement is not inside a switch block.
"catch" without "try"
The catch statement does not match a try block.
"break" or "continue" not in a loop
The break or continue statement is not inside a while or for block.
Variable name reused
Same variable used twice as input or as output argument.
Too many user functions
Not enough memory for that many user functions.
Attempt to redefine a function
A function with the same name already exists.
Can't find function definition
Cannot find a function definition during compilation.
Unexpected end of expression
Missing right parenthesis or square bracket.
Unexpected statement
Expression expected, but a statement is found (e.g. if).
Null name
Name without any character (when given as a string in functions like feval and struct).
Name too long
More than 32 characters in a variable or function name.
Unexpected function header
A function header (keyword "function") has been found in an invalid place, for example in the argument of eval.
Function header expected
A function header was expected but not found.
Bad variable in the left part of an assignment
The left part of an assignment does not contain a variable, a structure field, a list element, or the part of an array which can be assigned to.
Bad variable in a for loop
The left part of the assignment of a for loop is not a variable.
Source code not found
The source code of a function is not available.
File not found
fopen does not find the file specified.
Bad file ID
I/O function with a file descriptor which neither is standard nor corresponds to an open file or device.
Cannot write to file
Attempt to write to a read-only file.
Bad seek
Seek out of range or attempted on a stream file.
Too many open files
Attempt to open too many files.
End of file
Attempt to read data past the end of a file.
Timeout
Input or output did not succeed before a too large amount of time elapsed.
No more OS memory
The operating system cannot allocate more memory.
Bad context
Call of a function when it should not (application-dependent).
Not supported
The feature is not supported, at least in the current version.