package menhirGLR

  1. Overview
  2. Docs

Module MenhirGLR.GSSSource

Sourcetype ('s, 'v) node = {
  1. state : 's;
    (*

    A state of the LR(1) automaton.

    *)
  2. date : int;
    (*

    An input offset, measured in tokens. This number can be understood as the number of input tokens that were consumed before this node was created. It can also be understood as the logical time at which this node was created.

    *)
  3. mutable edges : ('s, 'v) edge MiniBabySet.tree;
    (*

    The outgoing edges of this node. When the GSS is understood as a set of LR stacks, each edge represents a possible tail of the stack. An initial node has no outgoing edges; a non-initial node has at least one outgoing edge. Every edge must go towards a node that inhabits the same generation or an older generation. New edges can be added to a node at offset date only while the parser is performing reductions at this offset; once this process is over, this field becomes immutable.

    *)
  4. mutable ddepth : int;
    (*

    The deterministic depth of this node, as described by McPeak. This is the number of outgoing edges that one can follow without encountering a join node.

    *)
}
Sourceand ('s, 'v) edge = {
  1. node : ('s, 'v) node;
    (*

    The destination node of this edge.

    *)
  2. mutable semv : 'v;
    (*

    The semantic value carried by this edge. Semantic values are constructed in a bottom-up manner: therefore this field goes through two distinct phases. In the first phase, this field can be updated: the semantic value that is stored in this field can be merged with a newly discovered semantic value, which represents another way of parsing the same input segment. In the second phase, the field becomes immutable and public: the semantic value that it contains can be passed to semantic actions. The two phases must not overlap: a semantic value that is not yet complete must not be made visible to a semantic action.

    *)
  3. mutable locked : bool;
    (*

    This field is true once the second phase has been entered. Then semv can be read by a semantic action, but can no longer be updated. Conversely, when this field is false, semv can be updated but cannot be read by a semantic action.

    *)
}