Stream: t-compiler/wg-rls-2.0

Topic: RustPython pep484 typechecker

Maxim Kurnikov (May 16 2019 at 14:50, on Zulip):

Hi. I want to implement pep484 type checker for Python in Rust, based on 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).

matklad (May 16 2019 at 14:55, on Zulip):

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.

Kevin Stenerson (May 16 2019 at 21:51, on Zulip):

@Maxim Kurnikov:

I've been able to re-use quite a bit of Rust Analyzer's code in implementing a similar linter for web application projects.


In particular, 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_parser/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.

Last update: Sep 22 2020 at 02:45UTC