Expand description
multi-stage compiler, it provides access to files in various compilation stages. Constists of multiple subsystems like: green tree parsing, linking, error reporting, smt checking etc.
The parsing frontend
To allow for more nimble and robust parsing, we use 2 stage process to parse 2 different syntax trees with different grammars:
- Source code is initially parsed with a very relaxed UVL tree-sitter grammar. This results in a loose syntax tree of UVL codefragments. We call this tree the ‘green tree’ it’s used for all syntax analysis. Its also very cheap to parse and incremental so it can be parsed on every keystroke for syntax highlighting and completion context information. Furthermore tree-sitter internal error recovery and temporal parsing provide good error corrections in many cases so parsing almost never fails.
- The green tree is translated into the red tree asynchronously. This second tree follows the UVL grammar spec and is used for all semantic analysis. During the translation from green to red tree very specific syntax errors can be detected and forwarded to the user. All red trees are later linked into a single model (the Root Graph). Green Trees are stored as Drafts while red trees are stored as an AST-ECS like structure See https://github.com/rust-lang/rust-analyzer/blob/master/docs/dev/syntax.md for inspiration
Structs§
- All the parsing components and their consumers in a central interface
Enums§
Functions§
- Handles update for a single draft and parses it incrementally with tree-sitter
- This handler links documents together, it also does type checking
- Turn a tree-sitter trees into a usable rust structure and send it to the linker