2.3.0
Fixed
- Fixed wrong compilation order of appended files (#155).
- Fixed inadequate reporting of syntax error (#156).
- Fixed Wrong handling of comparison operators by Data Flow Optimization (#158).
- Fixed wrong parsing of formattable string literals.
- Fixed inadequate handling of unsupported expressions embedded in formattable string literals.
Added
- Breaking: Added support for syntax variants (
strict
andrelaxed
) to Mindcode. The Strict syntax is the default now; to be able to compile existing Mindcode the Relaxed syntax needs to be activated using the#relaxed;
directive. - Added support for the Mlog Watcher Mindustry mod integration to both the web app and the command-line tool. This mod allows the compiled code to be automatically injected into a selected processor in a running Mindustry game.
- Added variable name validation: when inserting mlog into Mindustry processor, variables named
configure
are silently renamed toconfig
. For this reason, usingconfigure
as a name for any variable in Mindcode causes an error. - Added navigable compiler error messages to the web app. Clicking on a message with known position in the source code selects the corresponding position in the editor.
- Added support for outputting the error messages by the command line tool in a format which allows IDEs to parse the position and navigate to the error location in the source code.
- Added a variety of new optimizations to the Expression Optimization.
op
instruction: many new optimizations when one of the two operands is known.lookup
instruction: when possible, the instruction is replaced by aset
instruction setting the item, liquid, building or unit directly to the target variable, allowing further optimizations to take place. Effective onaggresive
optimization level.
- Added warning messages when deprecated features are detected in the source code.
- Added support for creating constants from formattable string literals.
- Added full support for the
sync()
function: a variable passed as an argument to this function becomes automatically volatile.
Schemacode
- Added support for block comments, delimited by
/*
and*/
. These comments can span multiple lines.
Experimental features
- Added support for Mindustry Logic from upcoming version 8. The features supported correspond to the current implementation in Mindustry and might therefore still change. All new features are described in a separate documentation.
- Added a system library, automatically included when the language target is
8A
or higher. - Added support to the If Expression Optimization to propagate values in
if
expressions not just into theset
instruction, but into any instruction taking an input parameter. Available on theexperimental
optimization level.
Changed
- Breaking: Changed the implementation of the
printf()
function under language targetML8A
. Instead of compile-time formatting of passed parameters, the function usesprint
andformat
instructions for run-time formatting. - Changed the definition of the
&&
and||
operators: they are guaranteed to always evaluate to either0
or1
. - Changed the
min()
andmax()
functions to accept more than just two arguments. - Changed the Temporary Variables Elimination optimization to replace unused output variables in instructions with
0
, to ensure no unnecessary variable will be created by the instruction, reducing clutter. Closes #154. - Changed the If Expression Optimization to support value propagation for all instructions having one output parameter (based on instruction metadata), instead of just a subset of specifically handled instructions.
- Changed - yet again - the way the Single Step Elimination optimization removes the last instruction which is a jump to the beginning of the program, so that it doesn't leave behind any jump that might have targeted the removed instruction. Such a jump was harmless, but unnecessary and looked strange in the mlog.
- Changed the text buffer handling in the processor emulator to recognize identical outputs produced by consecutive
printflush
operations and avoid creating duplicate outputs. - When a compiler-generated variable is evaluated as uninitialized (this situation indicates a bug in some of the optimizers), an internal error is thrown.
Deprecated
- Deprecated the original Mindcode syntax.
- Deprecated the usage of parentheses around the list of values in list iteration loops.
- Deprecated escaped double quotes in string literals.
- Deprecated kebab-case identifiers (note that built-in mlog variables, such as
@blast-compound
, will continue to be supported). - Deprecated the
printf()
function in language targetML7A
and earlier. - Deprecated the
configure
property. This property from Mindustry Logic 6 was replaced byconfig
in Mindustry Logic 7.
Miscellaneous
- Added parallel execution of unit tests.
- Renamed the command-line tool module from
compiler
totoolapp
, and the Mindcode compiler module frommindcode
tocompiler
. - Renamed the files in
bin
directory frommcc
/mcc.bat
tomindcode
/mindcode.bat
.