Fleet  0.0.9
Inference in the LOT
Public Member Functions | Public Attributes | Static Public Attributes | Protected Attributes | List of all members
Rule Class Reference

#include <Rule.h>

Public Member Functions

 Rule (const nonterminal_t rt, void *f, const std::string fmt, std::initializer_list< nonterminal_t > c, double _p=1.0, Op o=Op::Standard, int a=0)
 
bool is_a (Op o) const
 
bool is_recursive () const
 
Instruction makeInstruction (int a) const
 
Instruction makeInstruction () const
 
bool operator< (const Rule &r) const
 
bool operator== (const Rule &r) const
 
size_t get_hash () const
 
bool is_terminal () const
 
nonterminal_t type (size_t i) const
 
auto & get_child_types () const
 
std::string string () const
 

Public Attributes

nonterminal_t nt
 
std::string format
 
size_t N
 
double p
 
void * fptr
 
Op op
 
int arg =0
 
std::vector< nonterminal_tchild_types
 

Static Public Attributes

static const std::string ChildStr = "%s"
 

Protected Attributes

std::size_t my_hash
 

Detailed Description

Author
piantado
Date
08/02/20

Constructor & Destructor Documentation

◆ Rule()

Rule::Rule ( const nonterminal_t  rt,
void *  f,
const std::string  fmt,
std::initializer_list< nonterminal_t c,
double  _p = 1.0,
Op  o = Op::Standard,
int  a = 0 
)
inline

Member Function Documentation

◆ get_child_types()

auto& Rule::get_child_types ( ) const
inline

◆ get_hash()

size_t Rule::get_hash ( ) const
inline

◆ is_a()

bool Rule::is_a ( Op  o) const
inline

◆ is_recursive()

bool Rule::is_recursive ( ) const
inline

◆ is_terminal()

bool Rule::is_terminal ( ) const
inline

A terminal rule has no children.

Returns

◆ makeInstruction() [1/2]

Instruction Rule::makeInstruction ( int  a) const
inline

◆ makeInstruction() [2/2]

Instruction Rule::makeInstruction ( ) const
inline

◆ operator<()

bool Rule::operator< ( const Rule r) const
inline

We sort rules so that they can be stored in arrays in a standard order. For enumeration, it's actually important that we sort them with the terminals first. So we sort first by terminals and then by probability (higher first).

Parameters
r
Returns

◆ operator==()

bool Rule::operator== ( const Rule r) const
inline

Two rules are equal if they have the same instructions, nonterminal, format, children, and children types

Parameters
r
Returns

◆ string()

std::string Rule::string ( ) const
inline

◆ type()

nonterminal_t Rule::type ( size_t  i) const
inline

What type is my i'th child?

Parameters
i
Returns

Member Data Documentation

◆ arg

int Rule::arg =0

◆ child_types

std::vector<nonterminal_t> Rule::child_types

◆ ChildStr

const std::string Rule::ChildStr = "%s"
static

◆ format

std::string Rule::format

◆ fptr

void* Rule::fptr

◆ my_hash

std::size_t Rule::my_hash
protected

◆ N

size_t Rule::N

◆ nt

nonterminal_t Rule::nt

◆ op

Op Rule::op

◆ p

double Rule::p

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