Would love to get some feedback on https://github.com/rust-analyzer/rowan/pull/13
This PR makes the sytnax tree library we use non-generic, which might be a good trade off considering that the tree itself never uses generic parameters itself.
I've been using
rowan as the underlying framework for my parser and I'm a big fan of this. Is there any appetite in pulling out
rust-analyzer/ra_parsers event-driven parsing framework to rowan (or a separate crate)? I think it has a lot of potential for generic IDE tooling, e.g., could be used to build a Rust solution to IntelliJ's GrammarKit.
@Gary Tierney I've actually experimented with rust Grammar Kit thing before rowan: https://github.com/matklad/fall
was able to parse full rust with ti: https://github.com/matklad/fall/blob/master/lang/rust/syntax/src/rust.fall
As for pulling away the parsing framework, that's a good question!
I am increasingly becoming convinced that parser and syntax tree should be completely orthogonal
So, there probably shouldn't be "rowan-specific" parser framework
I am however not sure how exactly the API between the parser and the tree builder should look like
the main question here is "to type or not to type" :-)
If we go with untyped version, that something like IntelliJ's marks (don't remmeber how they are called) should work
However, the API should allow to construct a typed tree as well, and I don't know how to do that nicely
that actually is an extremely interesting question! One thing we'd want to do in the future is to share the parser between rust-analyzer and rustc, and this setup will require us to have this kind of abstract parser
e.g., a tree of some syntax tree type
T, as opposed to a tree of
Not just a single type T, but like a tree of
StructDef which has
Like, when you write traditional parser, the types in AST guide you
hmm, I will think about that a bit and how it might fit into the existing
TreeSink work. I can appreciate the independence of syntax tree and parser. I think that's what enables making rapid changes to this sort of stuff.