Fleet  0.0.9
Inference in the LOT
Classes
Grammar.h File Reference

A grammar stores all of the rules associated with any kind of nonterminal and permits us to sample as well as compute log probabilities. More...

#include <tuple>
#include <array>
#include <exception>
#include "IO.h"
#include "Errors.h"
#include "Node.h"
#include "Random.h"
#include "Nonterminal.h"
#include "VirtualMachineState.h"
#include "VirtualMachinePool.h"
#include "Builtins.h"
Include dependency graph for Grammar.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  DepthException
 
class  Grammar< _input_t, _output_t, GRAMMAR_TYPES >
 
class  Grammar< _input_t, _output_t, GRAMMAR_TYPES >::RuleIterator
 

Detailed Description

A grammar stores all of the rules associated with any kind of nonterminal and permits us to sample as well as compute log probabilities.

This allows us to iterate over rules in a grammar, guaranteed to be in a fixed order (first by nonterminals, then by rule sort order.

A grammar stores rules in a fixed (sorted) order that is guaranteed not to change, and that puts terminals first and (lower priority) high probability first as determined by Rule's sort order. This can be accessed with an iterator that goes over all grammar rules, via Grammar.begin() and Grammar.end()

The grammar hypothesis can take lambdas and parse them into rules, using GRAMMAR_TYPES.

The template args GRAMMAR_TYPES stores the types used in this grammar. This is inherited by LOTHypothesis, which also passes them along to VirtualMachineState (in the form of a Tuple). So the types used and order are fixed/standardized in the grammar