Vcsn  2.2
Be Rational
vcsn::rat Namespace Reference

Classes

class  atom
 
struct  braced_expression
 An expression that "remembers" whether it was in parentheses. More...
 
class  const_visitor
 
class  constant
 
class  constant_term_visitor
 A functor to compute the constant term of an expression. More...
 
class  copier
 Functor to copy/convert a rational expression. More...
 
class  derivation_visitor
 Functor to compute the derivation of an expression. More...
 
class  driver
 State and public interface for rational expression parsing. More...
 
class  exp
 The abstract, non-parameterized, root for all rational expression node types. More...
 
class  expand_visitor
 
struct  expansionset
 
class  expressionset_impl
 A typed expression set. More...
 
class  hash
 
class  identities
 An expressionset can implement several different sets of identities on expressions. More...
 
class  info
 Gather information of the number of the different node types. More...
 
class  inner
 An inner node. More...
 
class  leaf
 The root from which to derive the final node types. More...
 
class  less
 A functor to check whether one rational expression is (strictly) less than another one. More...
 
class  location
 Abstract a location. More...
 
class  node
 The abstract parameterized, root for all rational expression types. More...
 
class  parser
 A Bison parser. More...
 
class  position
 Abstract a position. More...
 
class  printer
 
class  sizer
 Functor to compute the size of a rational expression. More...
 
class  slice
 Present a slice of the top of a stack. More...
 
class  split_visitor
 Break a rational expression into a polynomial. More...
 
class  stack
 
class  standard_visitor
 Build a standard automaton from an expression. More...
 
class  star_normal_form_visitor
 
class  thompson_visitor
 Build a Thompson automaton from an expression. More...
 
class  to_expansion_visitor
 Functor to compute the expansion of an expression. More...
 
class  tuple
 Implementation of nodes of tuple of rational expressions. More...
 
class  tuple< Context, false >
 
class  unary
 
class  variadic
 An inner node with multiple children. More...
 
struct  variant
 A char[S] buffer to store and retrieve objects. More...
 
class  weight_node
 An inner node implementing a weight. More...
 
class  zpc_visitor
 Build a ZPC automaton from an expression. More...
 

Typedefs

template<typename ExpSet >
using expression_polynomialset_t = polynomialset< context< ExpSet, weightset_t_of< ExpSet >>>
 Type of PolynomialSet of expressions from the ExpSet type. More...
 
template<typename ExpSet >
using expression_polynomial_t = typename expression_polynomialset_t< ExpSet >::value_t
 Type of polynomials of expressions from the ExpSet type. More...
 
using exp_t = std::shared_ptr< const exp >
 
template<typename Context >
using zero = constant< type_t::zero, Context >
 
template<typename Context >
using one = constant< type_t::one, Context >
 
template<typename Context >
using complement = unary< type_t::complement, Context >
 
template<typename Context >
using star = unary< type_t::star, Context >
 
template<typename Context >
using transposition = unary< type_t::transposition, Context >
 
template<typename Context >
using prod = variadic< type_t::prod, Context >
 
template<typename Context >
using conjunction = variadic< type_t::conjunction, Context >
 
template<typename Context >
using infiltration = variadic< type_t::infiltration, Context >
 
template<typename Context >
using ldiv = variadic< type_t::ldiv, Context >
 
template<typename Context >
using shuffle = variadic< type_t::shuffle, Context >
 
template<typename Context >
using sum = variadic< type_t::sum, Context >
 
template<typename Context >
using lweight = weight_node< type_t::lweight, Context >
 
template<typename Context >
using rweight = weight_node< type_t::rweight, Context >
 
template<typename Context >
using expression = std::shared_ptr< const node< Context >>
 
using class_t = std::set< std::pair< std::string, std::string >>
 A set of label ranges. More...
 
using irange_type = std::tuple< int, int >
 An integer range, for quantifiers/exponents. More...
 

Enumerations

enum  type_t {
  type_t::zero, type_t::one, type_t::atom, type_t::sum,
  type_t::prod, type_t::ldiv, type_t::conjunction, type_t::shuffle,
  type_t::infiltration, type_t::star, type_t::transposition, type_t::lweight,
  type_t::rweight, type_t::complement, type_t::tuple
}
 The possible types of expressions. More...
 
enum  precedence_t {
  precedence_t::sum, precedence_t::tuple, precedence_t::products, precedence_t::shuffle = products,
  precedence_t::conjunction = products, precedence_t::infiltration = products, precedence_t::ldiv, precedence_t::prod,
  precedence_t::word = prod, precedence_t::lweight, precedence_t::rweight, precedence_t::unary,
  precedence_t::star = unary, precedence_t::complement = unary, precedence_t::transposition = unary, precedence_t::exponent = unary,
  precedence_t::zero, precedence_t::one, precedence_t::atom
}
 The possible node precedence levels, increasing. More...
 

Functions

template<typename ExpSet >
expression_polynomialset_t< ExpSet > make_expression_polynomialset (const ExpSet &rs)
 From a ExpSet to its polynomialset. More...
 
template<typename InExpSet , typename OutExpSet = InExpSet>
OutExpSet::value_t copy (const InExpSet &in_rs, const OutExpSet &out_rs, const typename InExpSet::value_t &v)
 Copy/convert a rational expression. More...
 
template<typename ExpSet >
info< ExpSet > make_info (const typename ExpSet::value_t &r)
 
template<typename ExpSet >
printer< ExpSet > make_printer (const ExpSet &rs, std::ostream &out)
 
constexpr bool is_constant (type_t t)
 Whether is a constant (\z or \e). More...
 
constexpr bool is_unary (type_t t)
 Whether star, complement. More...
 
constexpr bool is_variadic (type_t t)
 Whether one of the variadic types. More...
 
std::ostream & operator<< (std::ostream &o, type_t t)
 
template<typename ExpSet >
size_t size (const ExpSet &rs, const typename ExpSet::value_t &r)
 
std::string to_string (identities i)
 Wrapper around operator<<. More...
 
std::istream & operator>> (std::istream &is, identities &i)
 Read from string form. More...
 
std::ostream & operator<< (std::ostream &os, identities i)
 Output in string form. More...
 
identities meet (identities i1, identities i2)
 
template<typename ExpSet >
size_t size (const typename ExpSet::value_t &r)
 
static int debug_level_ ()
 The nesting limit for parser traces, as specified per $YYDEBUG. More...
 
static std::istream & operator>> (std::istream &is, identities::ids_t &ids)
 
locationoperator+= (location &res, const location &end)
 Join two locations, in place. More...
 
location operator+ (location res, const location &end)
 Join two locations. More...
 
locationoperator+= (location &res, int width)
 Add width columns to the end position, in place. More...
 
location operator+ (location res, int width)
 Add width columns to the end position. More...
 
locationoperator-= (location &res, int width)
 Subtract width columns to the end position, in place. More...
 
location operator- (location res, int width)
 Subtract width columns to the end position. More...
 
bool operator== (const location &loc1, const location &loc2)
 Compare two location objects. More...
 
bool operator!= (const location &loc1, const location &loc2)
 Compare two location objects. More...
 
template<typename YYChar >
std::basic_ostream< YYChar > & operator<< (std::basic_ostream< YYChar > &ostr, const location &loc)
 Intercept output stream redirection. More...
 
static dyn::expression prefer (const dyn::expression &e, const dyn::expression &f)
 Generate an expression for "e <+ f = e % f + f". More...
 
static dyn::context ctx (const driver &d)
 Get the context of the driver. More...
 
static identities ids (const driver &d)
 Get the identities of the driver. More...
 
static parser::symbol_type yylex (driver &d)
 Use our local scanner object. More...
 
positionoperator+= (position &res, int width)
 Add width columns, in place. More...
 
position operator+ (position res, int width)
 Add width columns. More...
 
positionoperator-= (position &res, int width)
 Subtract width columns, in place. More...
 
position operator- (position res, int width)
 Subtract width columns. More...
 
bool operator== (const position &pos1, const position &pos2)
 Compare two position objects. More...
 
bool operator!= (const position &pos1, const position &pos2)
 Compare two position objects. More...
 
template<typename YYChar >
std::basic_ostream< YYChar > & operator<< (std::basic_ostream< YYChar > &ostr, const position &pos)
 Intercept output stream redirection. More...
 
dyn::expression read (const dyn::context &ctx, rat::identities ids, std::istream &is, const location &l=location{})
 The expression in stream is. More...
 

Variables

static constexpr const char *const superscripts []
 Exponents in UTF-8. More...
 

Typedef Documentation

using vcsn::rat::class_t = typedef std::set<std::pair<std::string, std::string>>

A set of label ranges.

Definition at line 12 of file fwd.hh.

template<typename Context >
using vcsn::rat::complement = typedef unary<type_t::complement, Context>

Definition at line 121 of file fwd.hh.

template<typename Context >
using vcsn::rat::conjunction = typedef variadic<type_t::conjunction, Context>

Definition at line 140 of file fwd.hh.

using vcsn::rat::exp_t = typedef std::shared_ptr<const exp>

Definition at line 16 of file fwd.hh.

template<typename Context >
using vcsn::rat::expression = typedef std::shared_ptr<const node<Context>>

Definition at line 182 of file fwd.hh.

template<typename ExpSet >
using vcsn::rat::expression_polynomial_t = typedef typename expression_polynomialset_t<ExpSet>::value_t

Type of polynomials of expressions from the ExpSet type.

Definition at line 27 of file split.hh.

template<typename ExpSet >
using vcsn::rat::expression_polynomialset_t = typedef polynomialset<context<ExpSet, weightset_t_of<ExpSet>>>

Type of PolynomialSet of expressions from the ExpSet type.

Definition at line 22 of file split.hh.

template<typename Context >
using vcsn::rat::infiltration = typedef variadic<type_t::infiltration, Context>

Definition at line 143 of file fwd.hh.

using vcsn::rat::irange_type = typedef std::tuple<int, int>

An integer range, for quantifiers/exponents.

Definition at line 78 of file parse.hh.

template<typename Context >
using vcsn::rat::ldiv = typedef variadic<type_t::ldiv, Context>

Definition at line 146 of file fwd.hh.

template<typename Context >
using vcsn::rat::lweight = typedef weight_node<type_t::lweight, Context>

Definition at line 174 of file fwd.hh.

template<typename Context >
using vcsn::rat::one = typedef constant<type_t::one, Context>

Definition at line 111 of file fwd.hh.

template<typename Context >
using vcsn::rat::prod = typedef variadic<type_t::prod, Context>

Definition at line 137 of file fwd.hh.

template<typename Context >
using vcsn::rat::rweight = typedef weight_node<type_t::rweight, Context>

Definition at line 177 of file fwd.hh.

template<typename Context >
using vcsn::rat::shuffle = typedef variadic<type_t::shuffle, Context>

Definition at line 149 of file fwd.hh.

template<typename Context >
using vcsn::rat::star = typedef unary<type_t::star, Context>

Definition at line 124 of file fwd.hh.

template<typename Context >
using vcsn::rat::sum = typedef variadic<type_t::sum, Context>

Definition at line 152 of file fwd.hh.

template<typename Context >
using vcsn::rat::transposition = typedef unary<type_t::transposition, Context>

Definition at line 127 of file fwd.hh.

template<typename Context >
using vcsn::rat::zero = typedef constant<type_t::zero, Context>

Definition at line 108 of file fwd.hh.

Enumeration Type Documentation

The possible node precedence levels, increasing.

When printing a word (i.e., a label with several letters), beware that it may require parens. Think of star(atom(ab)): if we print it as 'ab*', it actually means 'a(b*)'. So give words a lower precedence than star. This is the role of 'word' below.

Was part of printer<ExpSet>, but it resulted in different incompatible types between, for instance, printer<lat<lal_char, lal_char>> and printer<lal_char>, which is a problem when the former calls print_child of the latter, passing an argument of type precedence_t.

Enumerator
sum 
tuple 
products 
shuffle 
conjunction 
infiltration 
ldiv 
prod 
word 
lweight 
rweight 
unary 
star 
complement 
transposition 
exponent 
zero 
one 
atom 

Definition at line 34 of file printer.hh.

enum vcsn::rat::type_t
strong

The possible types of expressions.

They also code the order in which they are sorted by less, so that, for instance, polynomials always display \e + a, and never a + \e.

Enumerator
zero 
one 
atom 
sum 
prod 
ldiv 
conjunction 
shuffle 
infiltration 
star 
transposition 
lweight 
rweight 
complement 
tuple 

Definition at line 39 of file fwd.hh.

Function Documentation

template<typename InExpSet , typename OutExpSet = InExpSet>
OutExpSet::value_t vcsn::rat::copy ( const InExpSet &  in_rs,
const OutExpSet &  out_rs,
const typename InExpSet::value_t &  v 
)

Copy/convert a rational expression.

Template Parameters
InExpSetthe input expressionset type.
OutExpSetthe output expressionset type.

Definition at line 183 of file copy.hh.

Referenced by vcsn::rat::expressionset_impl< Context >::conv(), vcsn::dyn::detail::copy_expression(), and vcsn::rat::copier< InExpSet, OutExpSet >::visit_tuple< bool, Dummy >::work_().

static int vcsn::rat::debug_level_ ( )
static

The nesting limit for parser traces, as specified per $YYDEBUG.

Definition at line 88 of file driver.cc.

Referenced by vcsn::rat::driver::parse().

static identities vcsn::rat::ids ( const driver d)
inlinestatic

Get the identities of the driver.

Definition at line 89 of file parse.cc.

References vcsn::rat::driver::identities().

Referenced by vcsn::ast::context_parser::expressionset_(), vcsn::rat::expressionset_impl< Context >::make(), vcsn::rat::parser::parse(), vcsn::dyn::read_expression(), vcsn::to_expression(), and vcsn::tuple_expressionset().

Here is the call graph for this function:

constexpr bool vcsn::rat::is_constant ( type_t  t)
inline

Whether is a constant (\z or \e).

Definition at line 59 of file fwd.hh.

References one, and zero.

Referenced by vcsn::rat::exp::is_leaf().

constexpr bool vcsn::rat::is_unary ( type_t  t)
inline

Whether star, complement.

Definition at line 66 of file fwd.hh.

References complement, star, and transposition.

Referenced by vcsn::rat::exp::is_unary().

constexpr bool vcsn::rat::is_variadic ( type_t  t)
inline

Whether one of the variadic types.

Definition at line 74 of file fwd.hh.

References conjunction, infiltration, ldiv, prod, shuffle, and sum.

template<typename ExpSet >
expression_polynomialset_t<ExpSet> vcsn::rat::make_expression_polynomialset ( const ExpSet &  rs)
inline

From a ExpSet to its polynomialset.

Definition at line 33 of file split.hh.

References vcsn::detail::rs.

Referenced by vcsn::dyn::derivation(), vcsn::derivation(), vcsn::split(), and vcsn::dyn::split().

template<typename ExpSet >
info< ExpSet > vcsn::rat::make_info ( const typename ExpSet::value_t &  r)

Definition at line 201 of file info.hh.

template<typename ExpSet >
printer< ExpSet > vcsn::rat::make_printer ( const ExpSet &  rs,
std::ostream &  out 
)
identities vcsn::rat::meet ( identities  i1,
identities  i2 
)

Definition at line 72 of file identities.cc.

Referenced by vcsn::meet().

bool vcsn::rat::operator!= ( const position pos1,
const position pos2 
)
inline

Compare two position objects.

Definition at line 159 of file position.hh.

bool vcsn::rat::operator!= ( const location loc1,
const location loc2 
)
inline

Compare two location objects.

Definition at line 161 of file location.hh.

location vcsn::rat::operator+ ( location  res,
const location end 
)
inline

Join two locations.

Definition at line 122 of file location.hh.

position vcsn::rat::operator+ ( position  res,
int  width 
)
inline

Add width columns.

Definition at line 127 of file position.hh.

location vcsn::rat::operator+ ( location  res,
int  width 
)
inline

Add width columns to the end position.

Definition at line 135 of file location.hh.

location& vcsn::rat::operator+= ( location res,
const location end 
)
inline

Join two locations, in place.

Definition at line 115 of file location.hh.

position& vcsn::rat::operator+= ( position res,
int  width 
)
inline

Add width columns, in place.

Definition at line 119 of file position.hh.

location& vcsn::rat::operator+= ( location res,
int  width 
)
inline

Add width columns to the end position, in place.

Definition at line 128 of file location.hh.

position vcsn::rat::operator- ( position  res,
int  width 
)
inline

Subtract width columns.

Definition at line 141 of file position.hh.

location vcsn::rat::operator- ( location  res,
int  width 
)
inline

Subtract width columns to the end position.

Definition at line 147 of file location.hh.

position& vcsn::rat::operator-= ( position res,
int  width 
)
inline

Subtract width columns, in place.

Definition at line 134 of file position.hh.

location& vcsn::rat::operator-= ( location res,
int  width 
)
inline

Subtract width columns to the end position, in place.

Definition at line 141 of file location.hh.

std::ostream & vcsn::rat::operator<< ( std::ostream &  o,
type_t  t 
)
inline

Definition at line 14 of file printer.hxx.

References CASE.

std::ostream & vcsn::rat::operator<< ( std::ostream &  os,
identities  i 
)

Output in string form.

Definition at line 35 of file identities.cc.

References to_string().

Here is the call graph for this function:

template<typename YYChar >
std::basic_ostream<YYChar>& vcsn::rat::operator<< ( std::basic_ostream< YYChar > &  ostr,
const position pos 
)
inline

Intercept output stream redirection.

Parameters
ostrthe destination output stream
posa reference to the position to redirect

Definition at line 170 of file position.hh.

References vcsn::rat::position::filename.

template<typename YYChar >
std::basic_ostream<YYChar>& vcsn::rat::operator<< ( std::basic_ostream< YYChar > &  ostr,
const location loc 
)
inline

Intercept output stream redirection.

Parameters
ostrthe destination output stream
loca reference to the location to redirect

Avoid duplicate information.

Definition at line 174 of file location.hh.

References vcsn::rat::position::column, and vcsn::rat::location::end.

bool vcsn::rat::operator== ( const position pos1,
const position pos2 
)
inline

Compare two position objects.

Definition at line 148 of file position.hh.

bool vcsn::rat::operator== ( const location loc1,
const location loc2 
)
inline

Compare two location objects.

Definition at line 154 of file location.hh.

static std::istream& vcsn::rat::operator>> ( std::istream &  is,
identities::ids_t ids 
)
static
std::istream & vcsn::rat::operator>> ( std::istream &  is,
identities i 
)

Read from string form.

Definition at line 64 of file identities.cc.

References is.

static dyn::expression vcsn::rat::prefer ( const dyn::expression e,
const dyn::expression f 
)
inlinestatic

Generate an expression for "e <+ f = e % f + f".

Definition at line 1461 of file parse.cc.

References complement, conjunction, and sum.

Referenced by vcsn::rat::parser::parse().

dyn::expression vcsn::rat::read ( const dyn::context ctx,
rat::identities  ids,
std::istream &  is,
const location l 
)

The expression in stream is.

Definition at line 11 of file read.cc.

References ctx().

Referenced by vcsn::dyn::read_expression().

Here is the call graph for this function:

template<typename ExpSet >
size_t vcsn::rat::size ( const typename ExpSet::value_t &  r)

Definition at line 138 of file size.hh.

static parser::symbol_type vcsn::rat::yylex ( driver d)
inlinestatic

Use our local scanner object.

Definition at line 96 of file parse.cc.

References vcsn::rat::driver::scanner_.

Referenced by vcsn::rat::parser::parse().

Variable Documentation

constexpr const char* const vcsn::rat::superscripts[]
static
Initial value:
=
{
"⁰", "¹", "²", "³", "⁴", "⁵", "⁶", "⁷", "⁸", "⁹"
}

Exponents in UTF-8.

Definition at line 58 of file printer.hh.