The Mint Syntax Checker
mint -a databaseFile -A databaseFile -b libraryDir -d databaseFile -D macroDef -i infoLevel -I includePath -l -o outputFile -q -s -S -t errorNumber -U macroName -w width -x -v file
Mint analyzes a Maple program, and produces a report about possible errors in a Maple source file. If a source file is not given, the standard input is used to read Maple source statements. Unlike Maple, Mint does not terminate when it reads a quit statement. Instead, it terminates when it reaches the end of the input.
(Windows only) The wmint.exe program opens a file browser allowing you to select a .mpl file. Once selected, the file is sent to mint for analysis. The program is accessed from your Windows Start menu: Start > Programs > Maple 2019 > Tools > Mint or by double-clicking wmint.exe located in your Maple installation folder, in either the bin.win or the bin.X86_64_WINDOWS subfolder.
The library specification option (-b libraryDir) forces Mint to look in the library file located in the specified directory for library routines.
The define option (-D macroDef) option is used to predefine a macro for Maple's preprocessor (see $define). The -D option can be followed by either a symbol or a symbol, equal sign, and the definition of the symbol. Multiple -D options can be used to define multiple symbols.
The info level option (-i infoLevel) specifies the amount of information to be produced. The values allowed for infoLevel are:
Display no information
Display only severe errors
Display severe and serious errors (default)
Display warnings as well as severe and serious errors
Give a full report on variable usage as well as displaying errors and warnings
A severe error is an undisputable error, such as a break statement outside of any loop. A serious error is almost certainly a coding error, such as two nested loops using the same control variable, or code appearing immediately after a return statement. Warnings indicate possible coding errors, such as using an equation as a stand-alone statement (suggesting that an assignment was probably intended).
A report is displayed for each procedure in the file. A global report, for statements not contained within any procedure, is displayed after the procedure reports. If the severity of errors found within a procedure is less than what the info level specifies, then no report is produced for that procedure. In all cases, the most severe error found in the file will be used to set the exit status for Mint. The possible values exit status values are:
No errors or warnings
With an infoLevel of 0, Mint will produce no output, but will quietly return an exit status indicating the highest severity of error encountered.
If infoLevel is 4, a usage report is given for each procedure as well as global statements within the file. Each usage report shows how parameters, local variables, global variables, system-defined names and catenated names are used. For example:
Used as a value
Used as a table or list element
Used as a call-by-value parameter
Used as a call-by-name parameter (a quoted parameter)
Called as a function
Assigned a procedure
Assigned a list
Assigned a set
Assigned a range
Assigned a value as a table or list element
Assigned a function value (assigned a value to remember as a function value)
In addition, a list of all the error messages generated, is given.
The include option (-I includePath) specifies directories to be searched for files specified in $include directives. Multiple directories can be specified, separated by commas. Alternatively, multiple -I options can be used to specify multiple directories.
The Windows platform only option (-k) causes mint to pause before finishing. It prompts the user with the following message: "- Press Enter to quit -".
The library file option (-l) suppresses warnings and errors that are commonly caused by Maple library source files.
The use of global names beginning with an underscore ("_") is not reported, since such names are reserved for use by the Maple library.
Warnings about the assignment of values to the system-defined names, such as Digits and printlevel, are suppressed since this often happens in a library file.
This option also suppresses error messages regarding library file names being overwritten since one of the purposes of a library file is to assign a procedure to a library file name.
The output option (-o outputFile) specifies that Mint is to write its report to the specified file, instead of the standard output. This is often useful when Mint is used as part of script, or on platforms which don't have a concept of standard output.
The quiet option (-q) suppresses printing of the Maple logo at startup.
The suppress startup file option (-s) forces Mint to run without reading the Mint startup file. The Mint startup file can be used to specify command-line options to Mint. This file can contain several lines containing command-line options or arguments as you would type them on a command line. Since Mint first reads the file and then scans the command line, arguments on the actual command line can override arguments in the initialization file. A good use of the initialization file may be to enter the name of the Maple library procedure database file when using the -d option, eliminating the need to type this each time Mint is used.
The Mint startup file is called .mintrc under UNIX and Mac OS X and MINT.INI under Windows.
The Syntax checking only option (-S) overrides the info level specification, and allows only syntax error messages to appear in the output.
The toggle error reporting option (-t errorNumber) will switch between reporting and not reporting errors of the given type number. The error numbers and corresponding error messages are:
Severe errors - return code 3
"The following statements are not inside
Indicates that a break or next statement has
appeared outside of a loop.
Indicates that an error or return statement has
appeared outside of a procedure.
"These names were declared more than
once as a local variable:"
Indicates that the same local variable has been
declared more than once in a procedure's local
"These names appeared more than once in
the parameter list:"
Indicates that the same parameter has been
declared more than once in a procedure's parameter
"These names were declared as both a
local variable and a parameter:"
Indicates that a procedure has a parameter and
local variable with the same name.
"Invalid left hand side of assignment:"
Indicates that an invalid expression (e.g. a set,
a sum, etc.) appears on the left hand side of an
Serious errors - return code 2
"These names were used as the same loop
variable for nested loops:"
Indicates that an inner loop uses the same loop
control variable as an outer loop.
"There is unreachable code that will
never be executed:"
Indicates that a statement occurs immediately
after a break, next, return, or error statement.
Such a statement can never be reached during the
course of execution.
"These names were used as iteration
control variables for both a $, sum, or
product construct and a loop:"
Indicates that a construct such as seq, add, or $
uses the same control variable as an enclosing
"These names were used as global names
but were not declared:"
Indicates that a procedure makes use of some
global names, but has not declared them as such.
"Underscore names are reserved for use
in the library. These global names start
Indicates use of a global name beginning with the
underscore ("_") character. Such names are
reserved for use by Maple's supplied library.
"These local variables were never used:"
Indicates that the local variables were declared,
but never used within the procedure. Removing the
declarations can marginally improve performance
and reduce memory usage.
"These exported variables were never used:"
Indicates that the module exports were declared,
but never used within the module. Removing the
"These local variables were used but
never assigned a value:"
Indicates that a local variable's value was used,
but that no value was ever assigned to it,
suggesting a coding error.
Note that if a variable is intended to be used only
as a symbol in a procedure, and is not to be assigned,
declaring it as type nothing will avoid this error.
"These local variables were assigned a
value but otherwise not used:"
Indicates that a value was assigned to a local
variable, but that this variable was then never
used, suggesting a coding error.
"These parameters were never used:"
Indicates that the specified parameters of a
procedure were never actually referred to by name
within the procedure.
"These names defined in a macro or alias
statement were assigned a value:
Indicates that a value that has a macro expansion
appears on the right hand side of an assignment,
meaning that the object being assigned to is not
what it appears to be.
"These parameters were also used as
macro or alias names:"
Indicates that a procedure parameter name
conflicts with a macro or alias name.
"These local variables were also used as
Indicates that a procedure's local variable name
"These macro or alias names were
expanded to a non-name where a name was
Indicates that a macro or alias that expands to
something other than a name has appeared in a
context where a name is required.
"Possible implied multiplication:"
Indicates that an expression such as 2(x+1) has
been encountered. In Maple, this means "apply the
constant function 2 to the argument x+1", not
"multiply 2 by x+1".
"Quotes are not needed around these
Indicates that a name was written with backquotes
(``) when such quotes were redundant.
"These local variables were not declared
Indicates local variables that were implicitly
declared (Maple declares as local any variables
that are undeclared, and appear on the left hand
side of an assignment or as the control variable
of a loop).
Warnings - return code 1
"The following function calls disagree
with number of parameters in the
Indicates that a function was called with the
wrong number of arguments based on the information
given in a library database.
"These library names were assigned a
Indicates that a name appearing in a library
database was assigned to.
"These system defined names were
assigned a value:"
redefined in a macro or alias
Indicates that a system-defined name (e.g. Pi) was
"These catenated names were used:"
Indicates that the concatenation operator (||) was
used to create a name.
"These parameters or local variables are
also system defined names:"
Indicates that a parameter or local variable hides
a system defined name from use inside a procedure.
statement were redefined:"
Indicates that a pre-defined macro or alias has
"Control variable of seq, add, or mul
not referenced in body:"
Indicates that the body expression of a seq, add,
or mul call is not a function of the control
"Equations were used as statements on
the following lines:"
Indicates that an equation (e.g. a=b) occurs by
itself as a statement, suggesting that an
assignment (a:=b) might have been intended
"These parameters were never used
Indicates that a named formal parameter of a
procedure is never actually used within the body
of the procedure.
"These global variables were declared,
but never used:"
Indicates that the global variables were declared,
but never used within the procedure.
"These local variables were used before
they were assigned a value:"
Indicates that the local variables may have
been used in an expression before they were
"Ineffectual call to with() inside a proc"
Indicates that the with command was used inside
a procedure. The with() command binds names within
a package so the package prefix can be omitted.
When called inside a procedure, the bindings don't take
effect until the procedure is finished, so the short
names cannot be used within the procedure itself.
Consider the uses statement instead.
The undefine option (-u macroName) option is used to undefine a Maple preprocessor macro (see $undef) that was defined earlier on the command line by a -D option. The -U option must be followed by the symbol to undefine. Multiple -U options can be used to undefine multiple symbols.
The width option (-w width) specifies the line width, in characters, to which Mint should format its report. The default is 79 characters. The minimum is 40 characters.
The cross-reference option (-x) lists all functions called in the code.
The verbose option (-v) lists additional information such as the source files included in the code.
Procedure databases are files which contain information about the definition of procedures which is useful in ensuring that these procedures are used correctly. Each line in a database file contains the following:
name minArgs maxArgs nargsUsed fileName
where name is a legal Maple name without any embedded blanks; minArgs is the minimum number of arguments expected for name; maxArgs is the maximum number of arguments; nargsUsed is 1 if nargs or any of the related values args, _nparams, etc. (see the nargs help page) is used in the procedure body, and 0 otherwise. The last field, fileName, is optional, and is the name of the library source file in which name is defined. The entries on each line are in free format but must be separated from one another by at least one space character. The values for minArgs and maxArgs should be numbers in the range 0 to 999. If maxArgs is 999 for an entry, that denotes that the procedure has no upper limit on the number of arguments. There may be multiple entries for a particular procedure. Later entries supersede earlier ones.
-a databaseFile or -A databaseFile
The database file options (-a databaseFile or -A databaseFile) append procedure information to the specified database file. Any procedures defined in the input file will have their definitions appended to the database file. The minArgs and maxArgs values will both be the number of format parameters that appear in the procedure definition.
If the -A option was specified, procedures that refer to their arguments using args, nargs, _nparams, etc. (see the args help page) will have the nargsUsed field set to 1 in the database entry, which turns off argument count checking for that procedure. If instead the -a option was specified, such procedures are not written to the database at all, and the fileName field of the database is also not written.
The library database option (-d databaseFile) forces Mint to use the specified library database as the procedure database. This allows Mint to check for improper usage of the procedures in the input file. Multiple library databases can be specified.
The ctags option (-c ctagsFile) causes Mint to generate a file in "ctags" format. This is a file that records the name, source file, and line number of every procedure processed by Mint, and can be used by most common source code editors to jump directly to the definition of a procedure from a point where it is called. Information about ctags can be found at https://en.wikipedia.org/wiki/Ctags.
Color Output from Mint
On UNIX-compatible systems, the system environment variable MINT_COLORS can be set to tell Mint to generate output in color. The value of this environment variable should be set to a string of the form:
The left hand sides can be shortened to the shortest unambiguous sequence of characters, i.e.,
Each spec is a sequence of integers separated by semicolons, making up the numerical part of an ANSI X3.64 Select Graphic Rendition escape sequence to select a color or other highlighting attribute. The supported attributes and colors depend on the terminal that you are using. The following work on "xterm-256color" compatible terminals:
1 - bold
4 - underline
5 - blinking (not supported by many terminals)
7 - reverse video
30 through 37 - standard terminal colors
38;5;n where n is between 0 and 255 - extended colors. These can be viewed using the interface(showtermcolors) command in the command line version of Maple.
More information about attributes that may be supported by your terminal can be found at https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_(Select_Graphic_Rendition)_parameters.
See the readme.txt file for further reference.
Download Help Document
What kind of issue would you like to report? (Optional)