Parser/compiler errors
Whenever possible Mosel displays the location where an error has been detected during compilation in the format (line_number/character_position_in_line).
- E-100 Syntax error before token
-
The parser cannot continue to analyze the source file because it has encountered an unexpected token. When the error is not an obvious syntax error, make sure you are not using an identifier that has not been defined before.
Examples:
token: )writeln(3 mod)
mod must be followed by an integer (or a numerical expression evaluating to an integer).
token: writeif i > 0 write("greater") end-if
then has been omitted.
token: endif i > 0 then write("greater") end-if
A semicolon must be added to indicate termination of the statement preceeding the end-if. - E-101 Incompatible types (type_of_problem)
-
We try to apply an operation to incompatible types. Check the types of the operands.
Examples:
type_of_problem: assignmenti:=0 i:=1.5
The first assignment defines i as an integer, the second tries to re-assign it a real value: i needs to be explicitly declared as a real.
type_of_problem: cmp12=1=2
A truth value (the result of 12=1 is compared to a numerical value. - E-102 Incompatible types for parameters of `routine'
-
A subroutine is called with the wrong parameter type. This message may also be displayed instead of E-104 if a subroutine is called with the wrong number of parameters. (This is due to the possibility to overload the definition of subroutines).
Example:
procedure myprint(a:integer) writeln("a: ", a) end-procedure myprint(1.5)
The subroutine myprint is called with a real-valued argument instead of an integer. - E-103 Incorrect number of subscripts for `array'(num1/num2)
-
An array is used with num2 subscripts instead of the number of subscripts num1 indicated at its declaration.
Example:
`array'(num1/num2): `A'(2/1)declarations A: array(1..5,range) of integer end-declarations writeln(A(3))
- E-104 Incorrect number of parameters for `routine'(num1/num2)
-
Typically displayed if write or read are used without argument(s).
- E-106 Division by zero detected
-
Explicit division by 0 (otherwise error only detected at runtime).
- E-107 Math error detected on function `fct'
-
For example, a negative number is used with a fractional exponent.
- E-108 Logical expression expected here
-
Something else than a logical condition is used in an if statement.
- E-109 Trying to redefine `name'
-
Objects can only be defined once, changing their type is not possible.
Example:
i:=0 declarations i: real end-declarations
i is already defined as an integer by the assignment. - E-111 Logical expression expected for operator `op'
-
Example:
op: and2+3 and true
- E-112 Numeric expression expected for operator `op'
-
Examples:
op: +12+{13}
op: *uses "mmxprs" declarations x:mpvar end-declarations minimize(x*x)
Multiplication of decision variables of type mpvar is only possible if a suitable module (like mmnl) supporting non-linear expressions is loaded. - E-113 Wrong type for conversion
-
Mosel performs automatic conversions when required (for instance from an integer to a real) or when explicitly requested by using the type name, e.g. integer(12.5). This error is raised when an unsupported conversion is requested or when no implicit conversion can be applied.
- E-114 Unknown type for constant `const'
-
A constant is defined but there is not enough information to deduce its type or the type implied cannot be used for a constant (for instance a linear constraint).
- E-115 Expression cannot be passed by reference
-
We try to use a constant where an identifier is expected. For instance, only non-constants can be used in an initializations block.
- E-118 Wrong logical operator
-
A logical opeartor is used with a type for which it is not defined.
Example:
if("abc" in "acd") then writeln("?"); end-if
The operator in is not defined for strings. - W-121 Statement with no effect
-
A statement is used that has no effet, for example r += 0.
- E-122 Control parameter `param' unknown
-
The control parameters of Mosel are documented in the Mosel Reference manual under function getparam. All control parameters provided by a module, e.g. mmxprs, can be display with the command EXAM, e.g. exam -p mmxprs. In IVE this information is displayed by the module browser.
- E-123 `identifier' is not defined
-
identifier is used without or before declaring it. Check the spelling of the name. If identifier is defined by a module, make sure that the corresponding module is loaded. If identifier is a subroutine that is defined later in the program, add a forward declaration at the beginning of the model.
- E-124 An expression cannot be used as a statement
-
An expression stands where a statement is expected. In this case, the expression is ignored — typically, a constraint has been stated and the constraint type is missing (i.e. >= or <= ...) or an equality constraint occurs without decision variables, e.g. 2=1.
This error also appears when the return value of a function call is not retrieved. - E-125 Set expression expected
-
For instance computing the union between an integer constant and a set of integers: union(12+{13})
- E-126 String expression expected
-
A string is expected here: for instance a file name for an initializations block.
- E-127 A function cannot be of type `type'
-
Some types cannot be the return value of a function. Typically no function can return a decision variable (type mpvar).
- E-128 Type `type' has no field named `field'
-
Trying to access an unknown field in a record type.
Example:
declarations myrec=record i,j:integer end-record r:myrec end-declarations r.k:=0
k is not a field of r. - E-129 Type `type' is not a record
-
Trying to use a record dereference on an object that is not a record. For instance using i.j with i defined as an integer.
- E-130 A type definition cannot be local
-
It is not possible to declare a type in a procedure or function.
- W-131 Array `identifier' is not indexed by ranges: assignment may be incorrect
-
When performing an inline initialization (operator ::) on an array, it is recommended to list indices if the indexing sets are not ranges. Indeed, since order of set elements is not guaranteed the values provided may not be assigned to the expected cells in the array.
Example:
declarations a:array({3,2,1}) of integer end-declarations ! a::[3,2,1] !=> a(1)=3 a(2)=2 a(3)=1 a::([3,2,1])[3,2,1] !=> a(1)=1 a(2)=2 a(3)=3
- E-132 Set or list expression expected
-
Aggregate operators (like sum or forall) require sets or lists to describe the domains for their loops.
Example:
declarations i:integer end-declarations forall(i = 2) writeln(i)
Since i is declared as an integer before the loop, the expression i=2 is a logical expression (it checks whether i is equal to 2) instead of an index definition. - W-144 Symbol `identifier' implicitly declared
-
When a model is compiled with option -wi this message gets displayed for every symbol that is not explicitly declared by the model.
- E-147 Trying to interrupt a non existing loop
-
break or next is used outside of a loop.
- E-148 Procedure/function `identifier' declared but not defined
-
A procedure or functions is declared with forward, but no definition of the subroutine body has been found or the subroutine body does not contain any statement.
- E-149 Some requirements are not met
-
A package may declare requirements: these are symbols that must be declared by models using this package. This error occurs when a model uses a package without providing the definitions for all the requirements.
- E-150 End of file inside a commentary
-
A commentary (usually started with (!) is not terminated. This error may occur, for instance, with several nested commentaries.
- E-151 Incompatible type for subscript num of `identifier'
-
The subscript counter num may be wrong if an incorrect number of subscripts is used.
Example:
declarations A:array(1..2,3..4) of integer end-declarations writeln(A(1.3))
This prints the value 2 for num, although the second subscript is actually missing. - W-152 Empty set for a loop detected
-
This warning will be printed in a few cases where it is possible to detect an empty set during compilation.
- E-153 Trying to assign the index `idx'
-
Loop indices cannot be re-assigned.
Example:
declarations C: set of string D: range end-declarations forall(d in D) d+=1 forall(c in C) if (c='a') then c:='A'; end-if
Both of these assignments will raise the error. To replace an element of the set C, the element needs to be removed and the new element added to the set. - E-154 Unexpected end of file
-
May occur, for instance, if an expression at the end of the model file is incomplete and in addition end-model is missing.
- E-155 Empty `case'
-
A case statement is used without defining any choices.
- E-156 `identifier' has no type
-
The type of identifier cannot be deduced. Typically, an undeclared object is assigned an empty set.
- E-157 Scalar expression expected
-
Examples:
declarations B={'a','b','c'} end-declarations case B of 1: writeln("stop") end-case
The case statement can only be used with the basic types (integer, real, boolean, string).D:: [1,2]
Declaration of arrays by assignment is only possible if the index set can be deduced ( e.g. definition of an array of linear constraints in a loop). - E-159 Compiler option `option' unknown
-
Valid compiler options include explterm and noimplicit. See section Directive options for more details.
- E-160 Definition of functions and procedures cannot be nested
-
May occur, for instance, if end-procedure or end-function is missing and the definition of a second subroutine follows.
- E-161 Expressions not allowed as procedure/function parameter
-
Occurs typically if the index set(s) of an array are defined directly in the procedure/function prototype.
Example:
procedure myproc(F:array(1..5) of real) writeln("something") end-procedure
Replace either by array(range) or array(set of integer) or define A:=1..5 outside of the subroutine definition and use array(A) - E-162 Non empty string expected here
-
This error is raised, for example, by uses ""
- E-163 Array declarations in the form of a list are not allowed as procedure/function parameter
-
Basic types may be given in the form of a list, but not arrays.
Example:
procedure myproc(F,G,H:array(range) of real, a,b,c:real) writeln("something") end-procedure
Separate declaration of every array is required:procedure myproc(F:array(range) of real, G:array(range) of real, H:array(range) of real, a,b,c:real)
- W-164 A local symbol cannot be made public
-
Example:
procedure myproc declarations public i:integer end-declarations i:=1 end-procedure
Any symbol declared in a subroutine is local and cannot be made public. - E-165 Declaration of `identifier' hides a parameter
-
The name of a function/procedure parameter is re-used in a local declaration.
Example:
procedure myproc(D:array(range) of real) declarations D: integer end-declarations writeln(D) end-procedure
Rename either the subroutine argument or the name used in the declaration. - W-166 `;' missing at end of statement
-
If the option explterm is employed, then all statements must be terminated by a semicolon.
- E-167 Operator `op' not defined
-
A constructor for a type is used in a form that is not defined.
Example:
uses "complex" c:=complex(1,2,3)
The module complex defines constructors for complex numbers from one or two reals, but not from three. - E-168 `something' expected here
-
Special case of ``syntax error'' (E-100) where the parser is able to provide a guess of what is missing.
Examples:
something: :=a: 3
The assignment is indicated by :=.
something: ofdeclarations S: set integer end-declarations
of has been omitted.
something: ..declarations A: array(1:2) of integer end-declarations
Ranges are specified by ... - E-169 `identifier' cannot be used as an index name (the identifier is already in use or declared)
-
Example:
i:=0 sum(i in 1..10)
The identifier i has to be replaced by a different name in one of these lines. - E-170 `=' expects a scalar here (use `in' for a set)
-
Special case of syntax error (E-100).
Example:
sum(i = 1..10)
Replace = by in. - E-171 The [upper/lower] bound of a range is not an integer expression
-
Example:
declarations A: array(1..2.5) of integer end-declarations
Ranges are intervals of integers, so the upper bound of the index range must be changed to either 2 or 3. - E-172 Only a reference to a public set is allowed here
-
All index sets of a public array must also be public.
- E-173 Statement allowed in packages only
-
The block requirements can only be used in packages.
- E-175 Index sets of array types must be named
-
User types defined as arrays must be indexed by named sets (i.e. declared separately). For instance it is not allowed to use range or set of string as an index of such an array.
- E-176 Only a public type is allowed here
-
If a user type depending on another user type is declared declared public, the secondary type must also be public. For instance, assuming type T1 is private, it is not possible to declare T2 as a public T2=set of T1.
- E-177 Incorrect number of initializers (n1/n2)
-
In an inline initialization (operator ::) the number of provided values to assign does not match the list of indices.
- E-202 Integer constant expected
-
Versions numbers (stated by means of the version compiler directive) must consist in 1 to 3 numbers separated by dots (e.g. 1.2.3). This error is displayed if a version number does not conform to this syntax.
- E-207 Problem reference/type expected here
-
The operator with is used with something that is not a problem.
- E-208 There can be only one counter
-
The as counter declaration can appear only once in an iterator list.
- E-209 Missing loop indices
-
Typically an iterator list contains only a counter declaration: it is necessary to provide at least one index.
- E-210 String starting at line line is unfinished
-
A multiline string is not correctly terminated with the matching end marker.
- E-211 Invalid annotation syntax (ignored)
-
Malformed annotation that cannot be identified (e.g. containing .. or invalid characters—only alphanumeric and underscore are allowed in annotation names).
- E-212 Annotations: invalid path `name'
-
Some portion of the path forming an annotation identifier, e.g. cat1.cat2 is the path for the annotation !@cat1.cat2.name, cannot be accessed.
- E-213 Annotations: name `name' not found
-
Some portion of the path forming an annotation identifier, e.g. cat1.cat2 is the path for the annotation !@cat1.cat2.name, is not defined.
- E-214 Annotations: trying to redefine `name' (ignored)
-
An annotation can only be defined once.
- E-215 Annotations: invalid definition string for `name' (value)
-
Incorrect or incomplete annotation declaration in an @mc.def statement, such as duplicate or missing property or value, use of an unknown keyword. Please refer to the list of permissible declaration statements in Section Declaration.
- E-217 Annotations: wrong value `value' for `name' (expecting: value2)
-
An annotation is assigned a value that does not correpond to the value type or set of values that have been specified in its declaration (via @mc.def).
- E-218 Annotations: missing chapter for `name'
-
moseldoc is trying to add a documentation entry under a chapter or section that has not (yet) been defined.
Errors related to modules
- E-302 The symbol `identifier' from `module' cannot be defined (redefinition)
-
Two different modules used by a model define the same symbol (incompatible definitions).
- E-303 Wrong type for symbol `identifier' from `module'
-
Internal error in the definition of a user module (an unknown type is used): refer to the list of type codes in the Native Interface reference manual.
- W-306 Unknown operator `op' (code num) in module `module'
-
Internal error in the definition of a user module: refer to the list of operator codes in the Native Interface reference manual.
- E-307 Operator `op' (code num) from module `module' rejected
-
Internal error in the definition of a user module: an operator is not defined correctly.
- E-308 Parameter string of a native routine corrupted
-
Internal error in the definition of a user module: refer to the list of parameter type codes in the Native Interface reference manual.
- W-309 Problem type `typ' unknown: extension `ext' ignored
-
A module declares a native type as a problem extension but the compiler cannot find the base type. For instance the new type is named "myprob.pb" but "myprob" does not exist.
Errors related to packages
- E-320 Package `package' not found
-
A package has not been found in the module path (see section Directive uses for the search rules).
- E-321 `file' is not a package
-
Typically displayed if a model is used as a package (the source for the bim file starts with the model keyword instead of package).
- E-322 Wrong version for package `package'(using:num1.num2.num3/required:num4.num5.num6)
-
A model is compiled with package A depending on a package B. The bim file Mosel has loaded for B is not compatible with the one used for compiling A (found version num1.num2.num3, required version is num4.num5.num6).
- E-323 Package `package' imported several times
-
A package cannot be imported several times in a model. This error occurs usually when a model uses packages A and B, and package B already includes A.