Bertini 2 d882924 (2026-10-06 19:56 UTC)
Numerical algebraic geometry library (C++ core)
Loading...
Searching...
No Matches
canonical_decoding.hpp File Reference

The reader for the canonical exact text encoding of expression trees – the inverse of canonical_encoding.hpp (ADR-0042). More...

#include <cstddef>
#include <memory>
#include <string>
#include <string_view>
#include <vector>
#include "bertini2/function_tree/node.hpp"
Include dependency graph for canonical_decoding.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  bertini::node::DecodingCursor
 A read position over one canonical-encoding text, with the small lexical helpers the grammar needs (literals, words, netstrings, numbers). More...
struct  bertini::node::DecodingContext
 The back-reference table of one decoding pass: the nodes in first-encounter order, so #<index> resolves to the node the encoder numbered index. More...

Namespaces

namespace  bertini
namespace  bertini::node

Functions

std::shared_ptr< Node > bertini::node::DecodeCanonical (DecodingCursor &cursor, DecodingContext &ctx)
 Decode one node (and everything under it) from the cursor's position.
std::shared_ptr< Node > bertini::node::DecodeCanonicalTree (std::string const &text)
 Decode a whole tree from its canonical encoding text (fresh context).

Detailed Description

The reader for the canonical exact text encoding of expression trees – the inverse of canonical_encoding.hpp (ADR-0042).

The canonical encoding is the digest preimage the records archive stores for every system and homotopy. This reader turns that text back into an interned node DAG, so an archived system can be rebuilt with its content digest as the proof of fidelity: the decoded object encodes to the very same text. It is a plain recursive-descent reader over the grammar sketched in canonical_encoding.hpp; every node is rebuilt through its ordinary Make factory, so the result lands in (or comes from) the live intern tables.

Back-references (#<index>) resolve through the same first-encounter numbering the encoder used: a node receives its index when its opening parenthesis is read, before its children, exactly as the encoder numbers a node before descending.