Skip to content

Language Design, Parser References

Andrea Lattuada edited this page Jun 2, 2021 · 1 revision

@jaybosamiya (March 24th):

In regards to rust-analyzer, my impression is that it is a very well-designed project with extensibility kept explicitly in mind, so hopefully the parser is also well designed for extensibility (and briefly looking around, I found it quite understandable and clean to work with). At a high-level, I feel that even if it might not be perfect for our use case, it might be better than having to write a full grammar from scratch if a Rust grammar doesn't exist in a parser-generator we choose. Of course, the above list is not exhaustive, and maybe someone else might find even more applicable libraries we can use.

rust-analyzer is meant to be a good frontend for Rust, so it has good error messages. rustc's parser definitely has good error messages (as you must've seen whenever writing rust). pest has nice error messages. IIRC, tree-sitter is heavily influenced by academic works in error recovery (and is designed explicitly to be part of the editor cycle), so it would very likely would have good error messages? nom can have good messages, but is annoying to get it behaving nice for error reporting from personal experience. others: no idea.