Parser¶
Parsing of QVR domain-specific language syntax.
parser
¶
Parser for the quivers DSL.
The lexer/parser pipeline is delegated to panproto via the qvr
tree-sitter grammar registered in panproto-grammars-all. The public
parse entry point consumes .qvr source bytes and returns a
Module of dataclass AST nodes.
This package's submodules group the walker logic by topic:
._registryfor the panproto registry singleton,ParseError, and the_Treeview that every walker reads from.._helpersfor the low-level helpers_required_text,_required_field,_field_text, and_walk_draw_arg..optionsfor the[k=v, ...]option-block walkers..expressionsfor type / space / morphism-expression / let-arith walkers..program_stepsfor program-block step walkers..statementsfor the top-level_walk_statementdispatcher and every per-declaration walker (object, morphism, deduction, contraction, signature, encoder, decoder, loss, ...)..corefor the publicparse/parse_fileentry points and the whole-tree syntax validation that rejects ERROR and missing nodes.
Every public name is re-exported here so from quivers.dsl.parser
import X keeps working unchanged.
ParseError
¶
Bases: Exception
Raised when the .qvr source fails to parse or wrap into AST nodes.
parse
¶
parse(source: str | bytes, file_path: str = '<source>') -> Module
Parse .qvr source bytes into a Module.
Source code in src/quivers/dsl/parser/core.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | |