JuliaLang / JuliaLang/JuliaSyntax.jl
Diagnostics as pattern matching
- Dominant language
- Julia
- Stars
- 293
- Forks
- 50
- PR merge metrics
- No merged PRs in 30d
Description
I've been thinking about what we'd need for a diagnostics system which can really solve a couple of core problem I'm worrying about:
**Accessibility**: end users should be *easily* able to contribute new helpful and friendly diagnostics without understanding the code of the compiler frontend. Friendly comprehensible errors are most helpful to beginners, and beginners should be able to help writing these. But beginners will rarely be able to dive into JuliaSyntax.jl and make changes.
**Cleanliness** and separation of concerns: If possible I don't want to clutter the parser itself with large amounts of heuristic code and error/warning message formatting.
With these in mind, I want to claim that:
> For a parser system where a syntax tree is **always** produced, compiler diagnostics (warnings, errors) are not really different from linter messages based on symbolic pattern matching
Therefore, we should be inspired linters like semgrep in using pattern matching techniques to match warnings and errors against the (partially broken) AST that the compiler produces. Ideally, errors and warnings could be expressed declaratively as a piece of malformed Julia code with placeholders which capture parts of that code and an error message template.
Discuss :-)
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.