Files
sdk/pkg/analyzer/tool
Paul Berry ba42706e66 Begin developing code for "Wolf analysis".
Wolf analysis is an experimental part of the analyzer that I intend to
use as the basis for new, more advanced, lint rules and other
analyses. Its first phase will consist of lowering the abstract syntax
of each function or method to a stream of instructions for a minimal
stack machine.

This code implements the first few instructions for the minimal stack
machine (`function`, `end`, `literal`, and `drop`). These are
sufficient to express a simple function like:

    int f() => 0;

Which maps to the following instruction stream:

    function(int Function(), 0)
    literal(0)
    end

This code includes a validator that verifies that an instruction
stream is well-formed. In follow-up CLs I will add logic to convert an
analyzer AST to an instruction stream.

The internal representation of an instruction stream is code
genreated, because:

- I intend to add additional instructions in follow-up CLs, and I
  don't want to have to remember all the boilerplate for adding an
  instruction each time.

- Once the implementation is far enough along to start consuming large
  amounts of real-world Dart code, I would like to be able to
  investigate the performance effects of changing the internal
  representation. Code generation will make this a lot easier.

Change-Id: I4bc299d31ed108f6eebf9cca913d1484dbc9a3cf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/334644
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2023-11-08 17:50:43 +00:00
..