mlscript icon indicating copy to clipboard operation
mlscript copied to clipboard

Tail Recursion Optimization in the Block IR

Open CAG2Mark opened this issue 1 month ago • 0 comments

In this PR:

  • [x] Improve annotation system (supporting multiple annotation on terms, improved reporting system)
  • [ ] Tail recursion optimization on tail recursive functions
  • [ ] Tail recursion optimization for mutually tail-recursive functions

Note that functions containing a mix of tail-calls and non-tail-calls will also be supported, and you can assert that a particular call does not consume additional stack space by using the @tailcall annotation.

The logic will be the same as what is implemented https://github.com/hkust-taco/mlscript/pull/218.

This PR does not implement tail-rec mod cons.

CAG2Mark avatar Nov 17 '25 07:11 CAG2Mark