mindcode
mindcode copied to clipboard
A high level language for Mindustry Logic and Mindustry Schematics.
The Data Flow Optimizer mishandles loop expression. This code ``` x = 0 while true print(x + 1) x = rand(10) print(x + 1) end ``` compiles into ``` print...
Suggested by @limonovthesecond2 [here](https://github.com/cardillan/mindcode/issues/102#issuecomment-1937003118). In loops with expressions such as `if-else` and `case` after the expression is completed, the jump forwards to the next command after the comparing. However, we...
The latest release of Mindcode comes with a new Loop Unrolling optimization! [Loop unrolling](https://en.wikipedia.org/wiki/Loop_unrolling) is an optimization aimed at speeding up program execution, at the price of increased code size....
The following code doesn't compile: ``` getlink(index).enabled = false ``` It is necessary to rewrite it to ``` device = getlink(index) device.enabled = false ``` Supporting direct property access will...
A function that has an empty body won't compile - a syntax error is generated: ``` def foo(n) end foo(0) ``` Looks like the issue seems to be with the...
A case expression used as a function argument is compiled into two arguments: ``` print(case 1 when 1 then 2 end) ``` produces ``` set __tmp0 2 print 1 print...
i ve encountered a really large Project where one single function cost me 300+instruction usages. > Multiprocessing support - some kind of library or framework (probably) that could be used...
Inspired by https://github.com/mlogjs/mlogjs/issues/180. Variables reused in expressions that modify them do not preserve the original value. This code: ``` a = 1 print(a + (a += 1)) printflush(message1) ``` currently...
So, today's session of debugging some Mindcode has given me another idea: unit testing of Mindcode. We already have a processor emulator, so we can run compiled Mindcode. Unit tests...
I'm currently writing some logics and noticed that I had to copy and paste a set of functions across different logic files. It's not so convenient and can be disastrous...