WurstScript
WurstScript copied to clipboard
Idea: Improvement for intermediate language
This is just an idea to restructure the internal Wurst code, nothing about Wurst language features.
Restructure intermediate language to allow for unstructured control flow (goto
) and remove ifs/loops.
Then use something like people do for web assembly (relooper etc. to go back to Jass / structured control flow):
https://medium.com/leaningtech/solving-the-structured-control-flow-problem-once-and-for-all-5123117b1ee2
This has a few advantages:
- Would make it easy to generate code for constructs like `continue (#634)
- Would make it easier to extend the function inliner to functions with multiple
return
statements. - Might simplify some optimizations
- In the future, it might make other features easier to implement (delimited continuations or async/await)
- It's required if we want to use LLVM as an optimizer step.
- It's cool to implement this M;D
Challenges:
- Original algorithm assumes continue and break statements with labels. Probably have to use variables to handle this.