Awali
Another Weighted Automata library
Data Structures | Functions | Variables
awali::dyn::internal Namespace Reference

Implementation details of dyn layer (not stable). More...

Data Structures

struct  acceptor_t
 
struct  acceptor_t< bool >
 
struct  acceptor_t< std::string >
 
struct  aut_or_exp_t
 
union  aut_or_exp_t.__unnamed1__
 
struct  formatted_istream
 
struct  formatted_ostream
 
struct  opt_any_t
 
struct  opt_typed_value
 
struct  opt_untyped_value
 
class  option_t
 
struct  option_value_pair_t
 
struct  untyped_value
 
struct  Value
 

Functions

weight_t add_tdc_transition (automaton_t tdc, state_t src, state_t dst, const std::vector< std::string > &labels, weight_t w)
 
std::vector< std::vector< char > > alphabets (automaton_t tdc)
 
template<typename T >
any_cast (const any_t &a)
 
template<typename T >
bool any_typeof (const any_t &a)
 
automaton_t breaking_derived_term (ratexp_t exp, options_t opts={})
 Builds an automaton from a rational expression using the breaking derived term algorithm. More...
 
automaton_t compact_thompson (ratexp_t exp)
 
std::ostream & daut (automaton_t aut, std::ostream &out)
 
void del_tdc_transition (automaton_t tdc, state_t src, state_t dst, const std::vector< std::string > &labels)
 
automaton_t deprecated_parse_automaton (std::istream &i)
 
std::map< ratexp_t, weight_tderivation (ratexp_t exp, label_t lab, bool breaking=false)
 Derives a rational expression with respect to some label. More...
 
automaton_t derived_term (ratexp_t exp, options_t opts={})
 Builds an automaton from a rational expression using the derived term algorithm. More...
 
std::ostream & dot (automaton_t aut, std::ostream &out, options_t opts={})
 
std::ostream & efsm (automaton_t aut, std::ostream &out)
 
std::ostream & fado (automaton_t aut, std::ostream &out)
 
automaton_t fado (std::istream &in)
 
std::string gcp (const std::string &s1, const std::string &s2)
 
std::string get_final_output (automaton_t tdc, state_t src)
 
std::vector< std::string > get_tdc_label (automaton_t tdc, transition_t tr)
 
transition_t get_tdc_transition (automaton_t tdc, state_t src, state_t dst, const std::vector< std::string > &labels)
 
std::ostream & grail (automaton_t aut, std::ostream &out)
 
automaton_t grail (std::istream &in)
 
bool has_input_label (automaton_t tdc, std::string l)
 
bool has_label (automaton_t tdc, unsigned i, std::string l)
 
bool has_output_label (automaton_t tdc, std::string l)
 
bool has_tdc_transition (automaton_t tdc, state_t src, state_t dst, const std::vector< std::string > &labels)
 
std::ostream & img (automaton_t aut, std::ostream &o, std::string img, options_t opts)
 
std::vector< transition_tincoming (abstract_automaton_t const *aut, state_t s, bool all)
 
std::vector< char > input_alphabet (automaton_t tdc)
 
bool is_quotient (automaton_t aut1, automaton_t aut2)
 
std::ostream & json (automaton_t aut, std::ostream &out)
 
std::ostream & json (ratexp_t aut, std::ostream &out, json_ast_t extra_medata=json_ast::empty())
 
automaton_t lift_tdc (automaton_t tdc)
 
automaton_t load (const std::string &filename, bool &is_example, io_format_t format=JSON)
 
aut_or_exp_t load_aut_or_exp (std::string const &name, bool recurse=false)
 
json_ast_t load_json_ast (bool &found, std::string const &filename, bool recurse=false)
 Loads a json file as an AST (possibly an example). More...
 
json_ast_t load_json_ast (std::string const &filename, bool recurse=false)
 Loads a json file as an AST (possibly an example). More...
 
automaton_t make_automaton (std::string alphabet, std::string semiring="B")
 
automaton_t make_automaton_from_context (context::context_description cd)
 
automaton_t make_automaton_from_context (context::labelset_description ls, context::weightset_description ws)
 
automaton_t make_automaton_from_context (context_t ctx)
 
context_t make_context (context::context_description cd)
 
context_t make_context (context::labelset_description ls, context::weightset_description ws)
 
ratexp_t make_ratexp (const std::string &exp, const std::string &sr="B")
 
ratexp_t make_ratexp_with_alphabet (const std::string &exp, const std::string &alph, const std::string &sr="B", bool fixed_alphabet=true)
 
ratexp_t make_ratexp_with_context (const std::string &exp, context::labelset_description ls, context::weightset_description ws, bool fixed_alphabet=true)
 
ratexp_t make_ratexp_with_context (const std::string &exp, context_t ctx, bool fixed_alphabet=true)
 
ratexp_t make_ratexp_with_context (std::string const &exp, context::context_description cd, bool fixed_alphabet)
 
unsigned num_tapes (automaton_t tdc)
 
std::vector< transition_toutgoing (abstract_automaton_t const *aut, state_t s, bool all)
 
std::vector< char > output_alphabet (automaton_t tdc)
 
aut_or_exp_t parse_aut_or_exp (json_ast_t ast)
 
automaton_t parse_automaton (json_ast_t ast)
 
automaton_t parse_automaton (std::istream &i)
 
ratexp_t parse_ratexp (json_ast_t obj)
 
std::ostream & pdf (automaton_t aut, std::ostream &o, options_t opts={})
 
void rename_from_origin_inplace (automaton_t dst, automaton_t orig)
 
void set_final_output (automaton_t tdc, state_t src, const std::string &output)
 
transition_t set_tdc_transition (automaton_t tdc, state_t src, state_t dst, const std::vector< std::string > &labels)
 
transition_t set_tdc_transition (automaton_t tdc, state_t src, state_t dst, const std::vector< std::string > &labels, weight_t w)
 
automaton_t standard (ratexp_t exp)
 
std::vector< state_tstates (abstract_automaton_t const *aut, bool all)
 
std::ostream & svg (automaton_t aut, std::ostream &o, options_t opts={})
 
std::vector< transition_ttdc_in (automaton_t tdc, state_t s, const std::vector< std::string > &label)
 
std::vector< transition_ttdc_out (automaton_t tdc, state_t s, const std::vector< std::string > &label)
 
std::vector< state_ttdc_predecessors (automaton_t tdc, state_t s, const std::vector< std::string > &label)
 
std::vector< state_ttdc_successors (automaton_t tdc, state_t s, const std::vector< std::string > &label)
 
automaton_t thompson (ratexp_t exp)
 
std::vector< transition_ttransitions (abstract_automaton_t const *aut, bool all)
 
automaton_t weighted_thompson (ratexp_t exp)
 

Variables

size_t next_id
 Global variable that assign a unique identifier to each instance of option<T> independentely of type T. More...
 
const char spec =127
 

Detailed Description

Implementation details of dyn layer (not stable).


Data Structure Documentation

◆ awali::dyn::internal::aut_or_exp_t.__unnamed1__

union awali::dyn::internal::aut_or_exp_t.__unnamed1__
Data Fields
automaton_t aut
ratexp_t exp

Function Documentation

◆ add_tdc_transition()

weight_t awali::dyn::internal::add_tdc_transition ( automaton_t  tdc,
state_t  src,
state_t  dst,
const std::vector< std::string > &  labels,
weight_t  w 
)

◆ alphabets()

std::vector<std::vector<char> > awali::dyn::internal::alphabets ( automaton_t  tdc)

◆ any_cast()

template<typename T >
T awali::dyn::internal::any_cast ( const any_t a)

◆ any_typeof()

template<typename T >
bool awali::dyn::internal::any_typeof ( const any_t a)

◆ breaking_derived_term()

automaton_t awali::dyn::internal::breaking_derived_term ( ratexp_t  exp,
options_t  opts = {} 
)

Builds an automaton from a rational expression using the breaking derived term algorithm.

Parameters
expthe rational expression
Returns
an automaton that accepts
Parameters
optsA set of options. The following options are meaningful: KEEP_HISTORY.
See also
exp_to_aut

◆ compact_thompson()

automaton_t awali::dyn::internal::compact_thompson ( ratexp_t  exp)

◆ daut()

std::ostream& awali::dyn::internal::daut ( automaton_t  aut,
std::ostream &  out 
)

◆ del_tdc_transition()

void awali::dyn::internal::del_tdc_transition ( automaton_t  tdc,
state_t  src,
state_t  dst,
const std::vector< std::string > &  labels 
)

◆ deprecated_parse_automaton()

automaton_t awali::dyn::internal::deprecated_parse_automaton ( std::istream &  i)

◆ derivation()

std::map<ratexp_t, weight_t> awali::dyn::internal::derivation ( ratexp_t  exp,
label_t  lab,
bool  breaking = false 
)

Derives a rational expression with respect to some label.

Parameters
expThe rational expression to derive
labThe rational with respect to which the expression is derived.
breakingWhether to use the breaking variant.
Returns
return

◆ derived_term()

automaton_t awali::dyn::internal::derived_term ( ratexp_t  exp,
options_t  opts = {} 
)

Builds an automaton from a rational expression using the derived term algorithm.

Parameters
expthe rational expression
Returns
an automaton that accepts
Parameters
optsA set of options. Only KEEP_HISTORY is meaningful.
See also
exp_to_aut

◆ dot()

std::ostream& awali::dyn::internal::dot ( automaton_t  aut,
std::ostream &  out,
options_t  opts = {} 
)

◆ efsm()

std::ostream& awali::dyn::internal::efsm ( automaton_t  aut,
std::ostream &  out 
)

◆ fado() [1/2]

std::ostream& awali::dyn::internal::fado ( automaton_t  aut,
std::ostream &  out 
)

◆ fado() [2/2]

automaton_t awali::dyn::internal::fado ( std::istream &  in)

◆ gcp()

std::string awali::dyn::internal::gcp ( const std::string &  s1,
const std::string &  s2 
)

◆ get_final_output()

std::string awali::dyn::internal::get_final_output ( automaton_t  tdc,
state_t  src 
)

◆ get_tdc_label()

std::vector<std::string> awali::dyn::internal::get_tdc_label ( automaton_t  tdc,
transition_t  tr 
)

◆ get_tdc_transition()

transition_t awali::dyn::internal::get_tdc_transition ( automaton_t  tdc,
state_t  src,
state_t  dst,
const std::vector< std::string > &  labels 
)

◆ grail() [1/2]

std::ostream& awali::dyn::internal::grail ( automaton_t  aut,
std::ostream &  out 
)

◆ grail() [2/2]

automaton_t awali::dyn::internal::grail ( std::istream &  in)

◆ has_input_label()

bool awali::dyn::internal::has_input_label ( automaton_t  tdc,
std::string  l 
)

◆ has_label()

bool awali::dyn::internal::has_label ( automaton_t  tdc,
unsigned  i,
std::string  l 
)

◆ has_output_label()

bool awali::dyn::internal::has_output_label ( automaton_t  tdc,
std::string  l 
)

◆ has_tdc_transition()

bool awali::dyn::internal::has_tdc_transition ( automaton_t  tdc,
state_t  src,
state_t  dst,
const std::vector< std::string > &  labels 
)

◆ img()

std::ostream& awali::dyn::internal::img ( automaton_t  aut,
std::ostream &  o,
std::string  img,
options_t  opts 
)

◆ incoming()

std::vector<transition_t> awali::dyn::internal::incoming ( abstract_automaton_t const *  aut,
state_t  s,
bool  all 
)

◆ input_alphabet()

std::vector<char> awali::dyn::internal::input_alphabet ( automaton_t  tdc)

◆ is_quotient()

bool awali::dyn::internal::is_quotient ( automaton_t  aut1,
automaton_t  aut2 
)

◆ json() [1/2]

std::ostream& awali::dyn::internal::json ( automaton_t  aut,
std::ostream &  out 
)

◆ json() [2/2]

std::ostream& awali::dyn::internal::json ( ratexp_t  aut,
std::ostream &  out,
json_ast_t  extra_medata = json_ast::empty() 
)

◆ lift_tdc()

automaton_t awali::dyn::internal::lift_tdc ( automaton_t  tdc)

◆ load()

automaton_t awali::dyn::internal::load ( const std::string &  filename,
bool &  is_example,
io_format_t  format = JSON 
)

◆ load_aut_or_exp()

aut_or_exp_t awali::dyn::internal::load_aut_or_exp ( std::string const &  name,
bool  recurse = false 
)

◆ load_json_ast() [1/2]

json_ast_t awali::dyn::internal::load_json_ast ( bool &  found,
std::string const &  filename,
bool  recurse = false 
)

Loads a json file as an AST (possibly an example).

Parameters
foundindicate whether the file corresponds to an example file.
filenamethe name of the files
recurseif true the subdirectories of the example directories are explored

◆ load_json_ast() [2/2]

json_ast_t awali::dyn::internal::load_json_ast ( std::string const &  filename,
bool  recurse = false 
)

Loads a json file as an AST (possibly an example).

◆ make_automaton()

automaton_t awali::dyn::internal::make_automaton ( std::string  alphabet,
std::string  semiring = "B" 
)

◆ make_automaton_from_context() [1/3]

automaton_t awali::dyn::internal::make_automaton_from_context ( context::context_description  cd)

◆ make_automaton_from_context() [2/3]

automaton_t awali::dyn::internal::make_automaton_from_context ( context::labelset_description  ls,
context::weightset_description  ws 
)

◆ make_automaton_from_context() [3/3]

automaton_t awali::dyn::internal::make_automaton_from_context ( context_t  ctx)

◆ make_context() [1/2]

context_t awali::dyn::internal::make_context ( context::context_description  cd)

◆ make_context() [2/2]

context_t awali::dyn::internal::make_context ( context::labelset_description  ls,
context::weightset_description  ws 
)

◆ make_ratexp()

ratexp_t awali::dyn::internal::make_ratexp ( const std::string &  exp,
const std::string &  sr = "B" 
)

◆ make_ratexp_with_alphabet()

ratexp_t awali::dyn::internal::make_ratexp_with_alphabet ( const std::string &  exp,
const std::string &  alph,
const std::string &  sr = "B",
bool  fixed_alphabet = true 
)

◆ make_ratexp_with_context() [1/3]

ratexp_t awali::dyn::internal::make_ratexp_with_context ( const std::string &  exp,
context::labelset_description  ls,
context::weightset_description  ws,
bool  fixed_alphabet = true 
)

◆ make_ratexp_with_context() [2/3]

ratexp_t awali::dyn::internal::make_ratexp_with_context ( const std::string &  exp,
context_t  ctx,
bool  fixed_alphabet = true 
)

◆ make_ratexp_with_context() [3/3]

ratexp_t awali::dyn::internal::make_ratexp_with_context ( std::string const &  exp,
context::context_description  cd,
bool  fixed_alphabet 
)

◆ num_tapes()

unsigned awali::dyn::internal::num_tapes ( automaton_t  tdc)

◆ outgoing()

std::vector<transition_t> awali::dyn::internal::outgoing ( abstract_automaton_t const *  aut,
state_t  s,
bool  all 
)

◆ output_alphabet()

std::vector<char> awali::dyn::internal::output_alphabet ( automaton_t  tdc)

◆ parse_aut_or_exp()

aut_or_exp_t awali::dyn::internal::parse_aut_or_exp ( json_ast_t  ast)

◆ parse_automaton() [1/2]

automaton_t awali::dyn::internal::parse_automaton ( json_ast_t  ast)

◆ parse_automaton() [2/2]

automaton_t awali::dyn::internal::parse_automaton ( std::istream &  i)

◆ parse_ratexp()

ratexp_t awali::dyn::internal::parse_ratexp ( json_ast_t  obj)

◆ pdf()

std::ostream& awali::dyn::internal::pdf ( automaton_t  aut,
std::ostream &  o,
options_t  opts = {} 
)

◆ rename_from_origin_inplace()

void awali::dyn::internal::rename_from_origin_inplace ( automaton_t  dst,
automaton_t  orig 
)

◆ set_final_output()

void awali::dyn::internal::set_final_output ( automaton_t  tdc,
state_t  src,
const std::string &  output 
)

◆ set_tdc_transition() [1/2]

transition_t awali::dyn::internal::set_tdc_transition ( automaton_t  tdc,
state_t  src,
state_t  dst,
const std::vector< std::string > &  labels 
)

◆ set_tdc_transition() [2/2]

transition_t awali::dyn::internal::set_tdc_transition ( automaton_t  tdc,
state_t  src,
state_t  dst,
const std::vector< std::string > &  labels,
weight_t  w 
)

◆ states()

std::vector<state_t> awali::dyn::internal::states ( abstract_automaton_t const *  aut,
bool  all 
)

◆ svg()

std::ostream& awali::dyn::internal::svg ( automaton_t  aut,
std::ostream &  o,
options_t  opts = {} 
)

◆ tdc_in()

std::vector<transition_t> awali::dyn::internal::tdc_in ( automaton_t  tdc,
state_t  s,
const std::vector< std::string > &  label 
)

◆ tdc_out()

std::vector<transition_t> awali::dyn::internal::tdc_out ( automaton_t  tdc,
state_t  s,
const std::vector< std::string > &  label 
)

◆ tdc_predecessors()

std::vector<state_t> awali::dyn::internal::tdc_predecessors ( automaton_t  tdc,
state_t  s,
const std::vector< std::string > &  label 
)

◆ tdc_successors()

std::vector<state_t> awali::dyn::internal::tdc_successors ( automaton_t  tdc,
state_t  s,
const std::vector< std::string > &  label 
)

◆ thompson()

automaton_t awali::dyn::internal::thompson ( ratexp_t  exp)

◆ transitions()

std::vector<transition_t> awali::dyn::internal::transitions ( abstract_automaton_t const *  aut,
bool  all 
)

◆ weighted_thompson()

automaton_t awali::dyn::internal::weighted_thompson ( ratexp_t  exp)

Variable Documentation

◆ next_id

size_t awali::dyn::internal::next_id
extern

Global variable that assign a unique identifier to each instance of option<T> independentely of type T.

◆ spec

const char awali::dyn::internal::spec =127