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,_walk_options, and_walk_return_pattern..expressionsfor type / space / morphism-expression / let-arith walkers..axesfor axis-role and morphism-prior walkers..program_stepsfor program-block step walkers..statementsfor the top-level_walk_statementdispatcher and every per-declaration walker (object, morphism, kernel, deduction, contraction, signature, encoder, decoder, loss, ...)..corefor the publicparse/parse_fileentry points and_attach_docs.
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
12 13 14 15 16 17 18 19 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 | |