Git Product home page Git Product logo

mindustrycompiler's Introduction

MindustryCompiler

a langage that compile to mindustry asm code know as mindustry-logic,

What's mindustry-logic ? Here is a nice starting guide with in game screenshots: How To Use Procesors in 6.0

The language created here is a superset of mindustry-logic code

here's the website to show features in actions and compile your code

features

  • all mindustry-logic code are valide as it

  • jump to a reference:

    ...
    jump bottom always true true  <--- jump to #ref bottom
    ...
    #ref bottom  <--- set ref anywhere
    ...
    
  • comments:

    // this is a comment
    
    #ref loop // another comment after some blank lines
    
  • improve jump conition:

    jump loop  // <--- jump loop always true true
    jump inf 2 < 4  // <--- jump inf lowerThan 2 4
    
    // ==, ===, !=, >, >=, <, <=, ---> equal, notEqual, greaterThan, ...
    

You could check files here to see the difference from the same programme that compile to the same mindustry-logic

  • if else, else if condition:

    if 2 < 4
        print "2 < 4"
    else if 2 == 1
        print "2 == 1"
    
    elif 2 === 2  // "elif" is equivalent to "else if"
        print "2 === 2"
    
    else
        print "else"
    
  • function:

    add(a, b)
        add result a b
        return result
    
    x = 0
    x = add(x, 2)
    
  • module:

    import time
    
    time.wait(2)  // wait 2 secondes
    
  • static for loop:

    import msg
    
    set message message1
    
    for x, y in [(1, 2), (4, 3)]
        if x > y
            print "x : "
            print x
            print " higher than: "
            msg.printAndWait(y, message)
    
  • look files here for some code exemple that I use

coming soon

  • afectation a = 1 and simple operation +, -, /, *, ...

  • operation += -=

  • improve if, if var, if not var, and / or

  • fill empty args of ASM lines (ucontrol itemDrop store 800 0 0 0 -> ucontrol itemDrop store 800)

current usage

  • compile a file :

    mindc fileName

    exemple, in this folder:

    mindc tests/identicalCode/4-improveJump.code
  • get the result in clipboard to just past it in mindustry :

    mindc tests/identicalCode/4-improveJump.code --ctrlC
  • run interactive to play with it :

    mindc --interactive

Installation

you need python to run this software

  • check that you have it

    type in your shell/terminal :

    python3 --version

    must give you something like: Python 3._._

  • if you don't have it, install it :

    you could dowload python from here

install mindustry compiler

python3 -m pip install MindustryCompiler

run it

mindc

mindustrycompiler's People

Contributors

pythux avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.