Skip to content
/ minasm Public

Assembly-like language compiles to Mindustry Logic Language

License

Notifications You must be signed in to change notification settings

yangfl/minasm

Repository files navigation

MinAsm

Try it!

Assembly-like language that compiled to Mindustry Logic Language, inspired by https://pypi.org/project/MindustryCompiler/.

features:

  • superset of Mindustry Logic Language, any Logic code is valid here!
  • line-based macro language
  • control flow
  • comments
  • easy-to-understand compiler
You write.. It translates...
a = 1 set a 1
a += 1 op add a a 1
a = b * c op mul a b c
a = b.c sensor a b c
a = %c getlink a c
a = cell1[0] read a cell1 0
cell1[0] = a write a cell1 0
ucontrol boost 1 ucontrol boost 1 0 0 0 0
jump 0 jump 0 always x false
end 1 < 1 jump 0 lessThan 1 1
.if a == 1
  ...
.elif a == 1
  ...
.else
  ...
.fi
0: jump 3 notEqual a 1 # .if a == 1
1:   ...
2: jump 7 always x false
3: jump 6 notEqual a 1 # .elif a == 1
4:   ...
5: jump 7 always x false # .else
6:   ...
.label start
...
...
jump start a != 1
0: ...
1: ...
2: jump 0 notEqual a 1
.while a == 1
  ...
  .break b == 1 # can be conditional!
  .continue c == 1
  ...
.end
0: jump 6 notEqual a 1 # .while a == 1
1:   ...
2:   jump 6 equal b 1 # .break b == 1 // can be conditional!
3:   jump 0 equal c 1 # .continue c == 1
4:   ...
5: jump 0 always x false # .end
.do
  ...
.when a == 1 # also until available
0:   ...
1: jump 0 equal a 1 # .when a == 1 // also until available
.do
  ...
.until # ignore condition equals True, but generate better code
0: ...

About

Assembly-like language compiles to Mindustry Logic Language

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published