I'm pondering over doing indentation by using an AST created with an external (non-emacs) tool. But so far I do not really know where to start. Are there emacs packages which already did this? Any tips and hints are welcome.
There is emacs-tree-sitter, which is a package that uses tree-sitter a parser generator tool that can be use to get a AST of some supported languages. Also emacs-tree-sitter support the option of get the AST of some languages so you can manipulate it and get some info, the documentation is interesting.