Skip to content

Releases: cardillan/mindcode

3.5.2

24 May 16:39
Compare
Choose a tag to compare

3.5.2 - 2025-05-24

Fixed

  • Fixed function calls with missing arguments causing compiler error (#259).

Assets

3.5.1

20 May 18:17
Compare
Choose a tag to compare

3.5.1 - 2025-05-20

Fixed

  • Fixed internal error compiling loops containing a function call (#258).

Assets

3.5.0

19 May 22:43
Compare
Choose a tag to compare

3.5.0 - 2025-05-19

Fixed

  • Fixed wrong unsafe-case-switching optimization for small jump tables (#253).
  • Fixed wrong handling of side effects by the Case Switching optimization (#254).
  • Fixed incorrect IDs produced by the sensor ... @id instruction (#255).
  • Fixed unrecognized keywords for some instructions (#256).
  • Fixed incorrect block type obtained through the lookup instruction in compile-time evaluation and the processor emulator for zero logic ID.

Added

  • Added support for the new op sign, op round and unpackcolor Mindustry BE instructions to the compiler and processor emulator.
  • Added the output-profiling compiler option, which causes the profiling output (number of times each instruction was executed) to be written to the log file.

Experimental

  • Added support for using null literals in case expression. When used in case expressions involving Mindustry content, null values in the when clauses are supported by the Case Switching optimization too.

Changed

  • Breaking: The system library was changed to accommodate the new logic instructions:
    • The sign function in the math library was renamed to signInexact.
    • The signExact function in the math library was renamed to sign. This function corresponds to the Mindustry 8 instruction op sign, and when target 8 is selected, the instruction is used instead of the library implementation.
    • The order of parameters of the unpackcolor function in the graphics library was changed to match the unpackcolor instruction in Mindustry 8. When target 8 is selected, the instruction is used instead of the library implementation.
  • When splitting jump tables into multiple segments during jump table compression, the instruction jumping to the next segment is always placed first, to make the overall execution of the optimized case expression faster.
  • Other improvements to the Case Switching optimization: better optimization, more precise cost and benefit calculation, support for null values.

Miscellaneous

  • Mindustry Logic built-in functions take precedence over functions defined in system library. This allows system libraries to contain functions that can be used when a corresponding Mindustry Logic function doesn't exist in current target.
  • List of supported keywords and built-in variables for instruction parameters are now provided by mimex-generated metadata.
  • Added list of accepted built-in variables to the description of functions in the function reference.
  • The docker definition was updated to avoid unnecessary recompilations (courtesy of 3bd).
  • Updated BE metadata to the latest available BE build.
  • Added new metadata types, fixed zero logic IDs problem.

Assets

(Note: the above link was misconfigured and led to the 3.4.0 version of the compiler. It's fixed now. I'll stop putting the links here, I need to update them manually and when I forget, it only creates confusion.)

3.4.0

11 May 19:52
Compare
Choose a tag to compare

3.4.0 - 2025-05-11

Fixed

  • Removed unnecessary condition duplication for empty loops (#252).

Added

  • Added new functions to the graphics library:
    • Added setAlpha() function which takes a packed color as an argument (including e.g. named color literals) and returns a packed color with updated alpha channel.
    • Added packHsv() function which creates a packed color value out of hue, saturation, value and alpha components.
  • Expanded the Case Switching optimization:
    • Range checking of the input values may be suppressed using unsafe-case-optimization compiler directive.
    • Case expressions based on Mindustry content (e.g. items, block types and so on) can be optimized by converting the values to logic ids and building jump tables using these numerical values.
    • Large jump tables containing a lot of unused values may be split into two or more segments to save space.

Experimental features

Changed

  • Breaking: changed the command-line arguments of the offline compiler:
    • The -o command-line option no longer sets the optimization level, but specifies the name of the output file.
    • The output file needs to be specified using the -o or --output named argument.
    • There's a new -O option taking a numerical value (optimization level). Values 0 to 3 correspond to optimization levels none, basic, advanced and experimental.
  • Breaking: the remote call mechanism was redesigned. When recompiling code in a processor which utilizes remote calls, all related processors need to be recompiled too.
  • The mlog decompiler replaces illegal characters in mlog variable names with underscores. If names of some variables collide due to these conversions, a numeric index is appended to some of them until a unique name is found.

Miscellaneous

  • Added an instruction index to the function reference.
  • Added list of possible keywords to the description of functions in the function reference.
  • Added references to the relevant portion of Yruei's documentation to function reference.

Assets

3.3.3

26 Apr 20:38
Compare
Choose a tag to compare

3.3.3 - 2025-04-26

Fixed

  • Fixed internal error when compiling unused functions (#247).
  • Fixed whitelabel error in the web application when an internal compilation error occurs. The error is reported as a standard error message instead.

Assets

3.3.2

26 Apr 10:14
Compare
Choose a tag to compare

3.3.2 - 2025-04-26

Added

  • Support for dark mode in the web application (courtesy of 3bd). Light/dark mode follows the browser preference.
  • Support for named color literals (e.g. %[red]) in target 8.

Changed

  • Hexadecimal and binary literals can be specified as 64-bit unsigned numbers (e.g. 0xFFFFFFFFFFFFFFFF represents -1). These literals are encoded to mlog as is when possible. If the literal wouldn't be properly parsed by the target Mindustry version, it is encoded as a signed decimal literal.
  • Negative hexadecimal and binary literals are encoded to mlog as is (with possible conversion to lower case). If the literal wouldn't be properly parsed by the target Mindustry version, it is encoded as a signed decimal literal.

Miscellaneous

  • Fixed (hopefully) Discord links in the Readme.

Assets

3.3.1

16 Apr 17:52
Compare
Choose a tag to compare

3.3.1 - 2025-04-16

Fixed

  • Fixed the logic id translation from blocks to ids and back not handling all types of blocks (#246).
  • Fixed small bug in jump tables generation for unused arrays.

Added

Changed

  • Improved list iteration loops generation for symbolic labels to perform the same as a code compiled without symbolic labels.
  • Small improvements in chained random array access optimizations.

Miscellaneous

  • Updated BE metadata to the last available BE build.

Assets

3.3.0

11 Apr 21:52
Compare
Choose a tag to compare

3.3.0 - 2025-04-11

Fixed

  • Fixed some command-line options not having an effect in the command-line tool (#231).
  • Fixed wrong handling or hoisted set instruction setting up return address in subsequent loop unrolling (#234).
  • Fixed optimizations removing the spawn instruction when the output value was not used (#236).
  • Fixed Jump Optimization not performing the optimization in unrolled loops.
  • Fixed error in compile-time evaluation of an expression involving a character literal (#240).
  • Fixed incorrect compile-time evaluation of some logic IDs (#242).
  • Fixed possible incorrect handling of arguments passed to the print() and other output functions (#243).

Added

  • Breaking: new ref keyword was added to the language. Code that uses this keyword as a function or variable name will not compile and the variable or function will have to be renamed.
  • Added the char() function. The function returns the ASCII value of a character at given index from a string value using the read instruction, as supported in latest BE version.
  • Added support for invoking properties and the sensor functions on string values to support latest BE Enhancement of sensing string lengths using @size.
  • Added the strlen() function returning the length of a string determined at runtime.
  • Added support for compile-time evaluation of the length() function, allowing to specify offsets relative to the end of the array in subarrays (e.g. array[0 ... length(array) - 1]).
  • Added compile-time evaluation of either stable, or all built-in numerical variables (such as @pi or @unitCount).
  • Added a new remarks mode, comments, to compile remarks as mlog comments (# comment).
  • Added support for generating runtime boundary checks for explicitly declared external arrays.
  • Added new printLines() function to the printing library. The function prints each of its arguments on a new line.
  • Loop Hoisting optimizer enhanced with an ability to optimize instructions setting up return addresses of function calls.
  • Added handling of numerical literal values unsupported by Mindustry Logic version 7 and earlier (namely, -2147483648).
    When a numerical literal or constant expression has this value, a compile-time error is generated.
  • Added support for strings in read and sensor instructions to processor emulator.
  • Added a new --file-references command-line option.
  • Added a suggestion of the closest matching alternative when an unknown compiler directive or option value is found.
  • Added support for mlog syntax highlighting into the provided IntelliJ file type settings.

Experimental features

Changed

  • Breaking: underscores in multi-word command-line options were changed to hyphens.
  • The metadata used by Mindcode compiler and processor emulator now correspond to the compilation target. Schemacode still uses the latest version of the metadata for both building and decompiling schematics.
  • Compile-time evaluation cache is cleared when exiting function context. This forces primarily the length() function to be reevaluated in each call to an inline function, as its value depends on the actual arguments passed to the function.
  • Improved optimization of jumps by making multiple passes over jumps-related optimizers, up to the optimization passes limit.
  • Volatile built-in variables used an upper or lower bound in a ranged for-loop statement are used directly in the condition, without storing them in a temporary variable.
  • Stripped unnecessary .0 distinctions from local variable prefix.
  • The noinit modifier is no longer disallowed for local variables.
  • The processor emulator uses numerical values provided by metadata for built-in variables (such as @pi or @unitCount). The metadata version corresponds to the compilation target.

Assets

3.2.1

23 Mar 10:47
Compare
Choose a tag to compare

3.2.1 - 2025-03-23

Fixed

  • Fixed errors when trying to invoke properties on internal array elements (#228).
  • Fixed wrong optimization of list iteration loops (#229).
  • Fixed incorrect optimization of if expressions (#230).

Added

  • Added a warning when a variable declared volatile is not used anywhere in a program, which would preclude remote access to such a variable.

Changed

  • Enhanced Temporary Variables Elimination to remove superfluous temporary variables generated by the compiler for volatile variables.
  • Updated Dead Code Elimination to not remove dead writes to volatile variables.

Assets

3.2.0

16 Mar 14:39
Compare
Choose a tag to compare

3.2.0 - 2025-03-16

Fixed

  • Fixed the Start with a new schematic button causing HTTP 404.
  • Fixed the schematics decompiler incorrectly processing factories with no unit plan selected.
  • Fixed wrong values of @blockCount, @unitCount, @itemCount and @liquidCount variables in processor emulator (currently assigned values correspond to Mindustry Logic 8 regardless of the compiler target).

Added

  • Added mlog keywords as a preferred way to specify mlog keywords to Mindustry Logic functions.
  • Added support for passing mlog keywords and formattable string literals as arguments to inline functions.
  • Added support for creating constants out of mlog keywords.
  • Added known mlog keywords to the file type definitions of the provided Intellij IDEA IDE settings.
  • Added new mlogText() function for direct encoding of mlog instructions.
  • Added support for descending iteration order to Range Iteration Loops and List Iteration Loops (#174).
  • The description of the storage clause added in Mindcode 3.1 was added to the documentation.
  • Added a new Item Transport sample. The sample demonstrates the use of a simple remote call scheme for acquiring units.

Experimental features

Changed

  • Breaking: new keywords were added to the language: descending, module and remote. Code that uses any of these keywords as a function or variable name will not compile and the variable or function will have to be renamed.
  • All reads from and writes to variables declared volatile are preserved now. Volatile variables can be accessed from a remote processor safely.
  • Prefixes for local variables are created from function name by default. Use function-prefix option or command-line argument to generate shorter prefixes.
  • Changed the sort-variables option to use draw triangle instructions to create variables in a defined order.

Deprecated

  • Deprecated the loop keyword in do while loop.
  • Deprecated specifying mlog keywords without the : prefix in Mindustry Logic function calls.

Assets