Skip to main content

language that compile to Mindusty ASM, jump instruction can use references instead of line number, and more ...

Project description

MindustryCompiler

a langage that compile to mindustry asm code,

What's mindustry asm ? 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 what I call mindustry asm code named Mindustry Logic by it's creator

features

  • all mindustry asm 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 asm

  • 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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

MindustryCompiler-1.6-py3-none-any.whl (40.6 kB view details)

Uploaded Python 3

File details

Details for the file MindustryCompiler-1.6-py3-none-any.whl.

File metadata

  • Download URL: MindustryCompiler-1.6-py3-none-any.whl
  • Upload date:
  • Size: 40.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/51.1.2 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.2

File hashes

Hashes for MindustryCompiler-1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 eb3089e0a8598a3bb78b5585f0ae2a54e9f84b778bd45a5e6b066a59e6268adc
MD5 1a83065c2435bb7ac9e8bd0f585e496f
BLAKE2b-256 c08f1aab68bad6fb9faf44c5ca7551cfdc433e5560144bf1a528fa91f5db1279

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page