-
Notifications
You must be signed in to change notification settings - Fork 20
Open
Description
It would be nice if the compiler itself had features such as:
- Track identifiers defined in
str.rs. This module contains wrappers forArc<str>and is used in the parsing stage. If we can track theirSpanwhen parsing, they can be used for better error reporting and LSP features. - Optionally track comment positions when parsing: it would be helpful if we want to make a formatter for SimplicityHL.
- Multiple error outputs via error recovery: Right now, we have two separate issues with errors:
- Errors at the parser stage, which could be fixed if we moved to a parser with error recovery;
- Errors at the analysis stage, which could be fixed if we implemented better analysis with techniques similar to error recovery.
- Code diagnostics: In addition to error collection, some simple diagnostics can be added as warnings: it can be as simple as identifying unused variables, functions, and aliases. Right now it's hard to think about diagnostics beyond that, but as SimplicityHL grows and introduces more complex syntax, it can be expanded.
- Scope rework: Right now, scopes are created only during the analysis of the syntax tree. If we can rework scopes to persist user-defined identifiers, their spans and parent scopes, allowing access after analysis, it would greatly help with implementing LSP navigation (I had implemented scope management using a tree-sitter parser, but if we can implement it inside the compiler, I would not have to rewrite this logic from scratch for the LSP).
With #185, we want to implement the first three features by migrating to the chumsky parser and making the necessary changes.
KyrylR
Metadata
Metadata
Assignees
Labels
No labels