hkust-taco / mlscript

The MLscript programming language. Functional and object-oriented; structurally typed and sound; with powerful type inference. Soon to have full interop with TypeScript!
https://hkust-taco.github.io/mlscript
MIT License
174 stars 27 forks source link

Defunctionalization with base AST #196

Closed HarrisL2 closed 8 months ago

HarrisL2 commented 12 months ago

In-progress refactoring of the previous defunctionalization code which used its own IR. This implementation uses the base AST instead and can be fed back into the typer.

Points of Interest: Added new content to shared/src/main/scala/mlscript/syntax.scala to represent the bounds of evaluating a term Added var BoundedTerm to TermImpl to store evaluation result Added new flags :nm, :lift that allow the transformed AST to be used in the following stages Use flag :dd to debug the defunctionalization process

compiler/shared/test/diff/NuMono/Differentiation.mls A use case test that exposes many bugs with in the implementation, being worked on right now.

LPTK commented 9 months ago

@waterlens can you please have a very quick look at whether you see anything unreasonable or broken? We want to merge this soon. It's temporary code anyway since the whole approach will be refactored. Probably the most interesting/important stuff about this PR is the test suite.