Fleet  0.0.9
Inference in the LOT
Public Member Functions | Public Attributes | List of all members
BasicEnumeration< Grammar_t > Class Template Reference

#include <BasicEnumeration.h>

Public Member Functions

 BasicEnumeration (Grammar_t *g)
 
virtual Node toNode (IntegerizedStack &is, const nonterminal_t &nt)
 This is a handy function to enumerate trees produced by the grammar. This works by encoding each tree into an integer using some "pairing functions" (see https://arxiv.org/pdf/1706.04129.pdf) Specifically, here is how we encode a tree: if it's a terminal, encode the index of the terminal in the grammar. If it's a nonterminal, encode the rule with a modular pairing function and then use Rosenberg-Strong encoding to encode each of the children. In this way, we can make a 1-1 pairing between trees and integers, and therefore store trees as integers in a reversible way as well as enumerate by giving this integers. More...
 
virtual Node toNode (enumerationidx_t z, const nonterminal_t nt)
 
virtual Node toNode (const nonterminal_t nt, enumerationidx_t z)
 
virtual enumerationidx_t toInteger (const Node &n)
 

Public Attributes

Grammar_t * grammar
 

Constructor & Destructor Documentation

◆ BasicEnumeration()

template<typename Grammar_t >
BasicEnumeration< Grammar_t >::BasicEnumeration ( Grammar_t *  g)
inline

Member Function Documentation

◆ toInteger()

template<typename Grammar_t >
virtual enumerationidx_t BasicEnumeration< Grammar_t >::toInteger ( const Node n)
inlinevirtual

◆ toNode() [1/3]

template<typename Grammar_t >
virtual Node BasicEnumeration< Grammar_t >::toNode ( IntegerizedStack is,
const nonterminal_t nt 
)
inlinevirtual

This is a handy function to enumerate trees produced by the grammar. This works by encoding each tree into an integer using some "pairing functions" (see https://arxiv.org/pdf/1706.04129.pdf) Specifically, here is how we encode a tree: if it's a terminal, encode the index of the terminal in the grammar. If it's a nonterminal, encode the rule with a modular pairing function and then use Rosenberg-Strong encoding to encode each of the children. In this way, we can make a 1-1 pairing between trees and integers, and therefore store trees as integers in a reversible way as well as enumerate by giving this integers.

◆ toNode() [2/3]

template<typename Grammar_t >
virtual Node BasicEnumeration< Grammar_t >::toNode ( enumerationidx_t  z,
const nonterminal_t  nt 
)
inlinevirtual

◆ toNode() [3/3]

template<typename Grammar_t >
virtual Node BasicEnumeration< Grammar_t >::toNode ( const nonterminal_t  nt,
enumerationidx_t  z 
)
inlinevirtual

Member Data Documentation

◆ grammar

template<typename Grammar_t >
Grammar_t* BasicEnumeration< Grammar_t >::grammar

The documentation for this class was generated from the following file: