[x] define a language of code fragments, where each fragment is labelled and can be "called" from other fragments
[x] a program consists of a collection of fragments and the name of the starting fragment
[x] a compiler takes a program and lowers that to low-level ant instructions (note: lowering doesn't always mean inlining the fragments... otherwise cyclic references would be disallowed... how do we tackle this?)
Verification steps in the compiler:
[ ] all used labels exist (could we enforce this statically, by using something else than strings for the labels?)
[ ] the produced code is within the bounds (10.000)
Optimization passes: no idea what we could do... probably remove redundant code somehow.
[x] sense [LeftLeft, Left, Right, RightRight, Back]
[x] turn [Left, Right] until condition is met
Notes:
Because there are no local variables, some loops may become unrolled and functions are always inlined. This could cause an explosion in code size.
Discarded ideas
Cell markers to implement variables
A cell can have 6 different markers, which gives a total of 64 combinations.
Not realistic: letting a single ant read the value of the variable stored in a cell would require having 64 different branches in the code, for each read (that is the only way to keep state through reads).
Ideas
Architecture:
Verification steps in the compiler:
Optimization passes: no idea what we could do... probably remove redundant code somehow.
Primitive functions:
Notes:
Discarded ideas
Cell markers to implement variables