move-language / move

Apache License 2.0
2.24k stars 677 forks source link

[model-compiler] Enabling basic type checking of Move functions #1021

Closed wrwg closed 1 year ago

wrwg commented 1 year ago

This is a very first step to enable the move model to process Move functions from source (and not just bytecode), and thus act as a compiler.

In this initial approach, the old Move compiler is run together with the new one. This allows us to continue to have a CompiledModule in the GlobalEnv. Untangling the model from compiled module is a larger refactoring which we can factor out in different PRs.

A new model builder option compile_via_model is added. If set, the body of function definitions will be piped through the model's exp builder to translate expansion AST into model AST, which is now stored in the model and accessible via FunctionEnv::get_def(). The model AST has been extended to handle new imperative expression constructs, but the translator has not yet been extended to support imperative constructs. Test infra has been set up as well, to be refined as we proceed.