Hi. I want to implement pep484 type checker for Python in Rust, based on https://github.com/RustPython/RustPython AST, as an experiment / learning experience. Is there anything I could reuse from rust-analyser for the implementation?
For example, salsa for incremental recomputation of AST (not part of rust-analyser, but I got idea for it from your issue tracker).
I don't think you'll be able to reuse a lot of stuff.
You can use salsa for incrementality, but you probably don't need to be incremental.
There's ena crate which can be used to implement unification algorithm.
I've been able to re-use quite a bit of Rust Analyzer's code in implementing a similar linter for web application projects.
rowan is used to represent an AST,
salsa has been nice because I plan LSP support, but as mentioned its probably unnecessary complexity in the general case; though if you go that path
ra_vfs that has been broken out from Rust Analyzer is useful for loading files. I've replicated some of the
ra_db crate in
utils/analysis and the
ra_syntax crates in a more language-generic way in
utils/grammar. There is also
codegen/antlr which generates a parser using the
utils/grammar crate that products a
rowan based AST using a ANTLR-like syntax if you find an existing
antlr grammar for python.