where `filename` is a string and `optimization_level` is an optional integer
where `filename` is a string and `optimization_level` is an optional integer.
Optimization Level:
0. completely unoptimized.
1. the default
- modify variables without using a temporary
2. turns on some potentially unsafe optimizations
- augmented assignment and pre/postincrement/decrement don't modify \_\_rax
- augmented assignment and pre/postincrement/decrement don't modify `__rax`
- returning from main becomes equivalent to `end`
Locals are rewritten as _<varname>_<func_name>. Globals are unchanged.
Locals are rewritten as `_<varname>_<func_name>`. Globals are unchanged.
Special Variables:
- \_\_rax: similar to x86 rax
- \_\_rbx: stores left hand side of binary ops to avoid clobbering by the right side
- \_\_retaddr\_\*: stores return address of func call
- `__rax`: similar to x86 rax
- `__rbx`: stores left hand side of binary ops to avoid clobbering by the right side
- `__retaddr__<func_name>`: stores return address of func call
When developing your script, you can include `c2logic/builtins.h` located in the python include directory(location depends on system, mine is at `~/.local/include/python3.8/`)
When writing your code, you must include `c2logic/builtins.h`, which is located in the python include directory(location depends on system, mine is at `~/.local/include/python3.8/`).
See [examples](./examples) for API sample usage.
See [include/builtins.h](./include/builtins.h) for API definitions and [examples](./examples) for API sample usage.
# Documentation
# Supported Features
See `include/builtins.h` for API definitions.
- all Mindustry instructions as of BE
- all control flow structures except goto
- functions
- local/global variables
# Unsupported Features
- drawing
- getlink
- memory cell read/write
- structs
- enums
Some of these features may be worked around using `asm()`.