Skip to content

A high level language for Mindustry Logic (mlog) and Mindustry Schematics.

License

Notifications You must be signed in to change notification settings

cardillan/mindcode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mindcode

Mindcode is a high-level programming language for Mindustry Logic. Mindcode generates fairly well optimized mlog code, utilizing available instruction space to make the resulting code faster. It comes with a web app and a command-line compiler, provides means for integration both with various IDEs and Mindustry itself. The project uses lots of automated tests to make sure the produced code is correct.

Schemacode, an extension built over Mindcode, is a specialized definition language designed for creating a complete Mindustry schematic from a text file. Schematics builder compiles these definition files directly into Mindustry schematics, either into binary .msch file, or into the text representation. Processors can be included in these schematics, complete with the code (specified either in Mindcode or mlog) and linked blocks.

Tip

Mindcode currently undergoes substantial changes to the syntax. You might want to have a look at the upcoming changes that are still being deliberated. Comments and suggestions are welcome.

Mindcode Syntax

Please refer to the documentation for a complete description of Mindcode syntax. You can also use the code examples in the web application to get familiar with Mindcode.

Important

In the 2.3.0 release, Mindcode introduces a stricter form of the syntax where semicolons and the do/then keywords are no longer optional. The original syntax is deprecated, but will be available for some time through the #relaxed; directive, which can be put at the beginning of your code. Other changes to the syntax include compulsory out keywords for output function call arguments and using the @ prefix for Mindustry built-in variables used as properties. The old syntax is still supported, but generates a warning. See Strict and Relaxed syntax for a description of all changes to the syntax.

The relaxed variant of the syntax will be eventually removed.

Latest development

The most important recent changes to Mindcode include:

See changelog for a comprehensive list of changes.

Using Mindcode

Online

Mindcode is available at http://mindcode.herokuapp.com/. Write some Mindcode in the Mindcode Source Code text area, then press the Compile button. The Mindustry Logic text area will contain the mlog version of your Mindcode. Copy the mlog code into the clipboard. Back in Mindustry, edit your processor, then use the Edit button in the Logic UI. Select Import from Clipboard. Mindustry is now ready to execute your code.

You can also use the Compile and Run button to execute the compiled code right away on an emulated processor. The output produced by print instructions in your code will be displayed. Very limited interaction with the Mindustry World is supported.

Offline

Alternatively, you can download the command-line compiler and use Mindcode from within an IDE.

Mindustry Logic References

If you don't know much about Mindustry Logic, you can read more information about it here:

Unfortunately, other sources are rather dated at this moment:

Contributing

See CONTRIBUTING.

License

MIT. See LICENSE for the full text of the license.