diff --git a/alib2data/src/regexp/formal/FormalRegExp.h b/alib2data/src/regexp/formal/FormalRegExp.h
index 2e2630aca4319d53cab7d6ce41a04563db1515de..f7c966ad635629dfbf5030068d51d29917dac528 100644
--- a/alib2data/src/regexp/formal/FormalRegExp.h
+++ b/alib2data/src/regexp/formal/FormalRegExp.h
@@ -1,6 +1,22 @@
 /*
  * FormalRegExp.h
  *
+ * This file is part of Algorithms library toolkit.
+ * Copyright (C) 2017 Jan Travnicek (jan.travnicek@fit.cvut.cz)
+
+ * Algorithms library toolkit is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+
+ * Algorithms library toolkit is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with Algorithms library toolkit.  If not, see <http://www.gnu.org/licenses/>.
+ *
  *  Created on: Nov 23, 2013
  *      Author: Jan Travnicek
  */
@@ -33,84 +49,165 @@ namespace regexp {
 class GeneralAlphabet;
 
 /**
- * Represents regular expression parsed from the XML. Regular expression is stored
- * as a tree of RegExpElement.
+ * \brief
+ * Formal regular expression represents regular expression where nodes of concatenation and alternation have exactly two children. Describes regular languages.
+
+ * \details
+ * Definition is classical definition of finite automata.
+ * E = (T, C),
+ * T (Alphabet) = finite set of terminal symbols
+ * C (Content) = representation of the regular expression
+ *
+ * \tparam SymbolType used for the terminal alphabet
  */
 template < class SymbolType >
 class FormalRegExp final : public RegExpBase, public core::Components < FormalRegExp < SymbolType >, ext::set < SymbolType >, component::Set, GeneralAlphabet > {
-protected:
+	/**
+	 * The structure of the regular expression.
+	 */
 	FormalRegExpStructure < SymbolType > m_regExp;
 
 public:
 	/**
-	 * @copydoc FormalRegExpElement::clone() const
+	 * \brief Creates a new instance of the expression. The default constructor creates expression describing empty language.
 	 */
-	virtual RegExpBase * clone ( ) const;
+	explicit FormalRegExp ( );
 
 	/**
-	 * @copydoc FormalRegExpElement::plunder() const
+	 * \brief Creates a new instance of the expression with a concrete alphabet and initial content.
+	 *
+	 * \param alphabet the initial input alphabet
+	 * \param regExp the initial regexp content
 	 */
-	virtual RegExpBase * plunder ( ) &&;
-
-	explicit FormalRegExp ( );
-
 	explicit FormalRegExp ( ext::set < SymbolType > alphabet, FormalRegExpStructure < SymbolType > regExp );
+
+	/**
+	 * \brief Creates a new instance of the expression based on initial content. The alphabet is derived from the content.
+	 *
+	 * \param regExp the initial regexp content
+	 */
 	explicit FormalRegExp ( FormalRegExpStructure < SymbolType > regExp );
-	explicit FormalRegExp ( const UnboundedRegExp < SymbolType > & other );
 
 	/**
-	 * @return Root node of the regular expression tree
+	 * \brief Created a new instance of the expression based on the FormalRegExp representation.
 	 */
-	const FormalRegExpStructure < SymbolType > & getRegExp ( ) const &;
+	explicit FormalRegExp ( const UnboundedRegExp < SymbolType > & other );
 
 	/**
-	 * @return Root node of the regular expression tree
+	 * @copydoc FormalRegExpElement::clone() const
 	 */
-	FormalRegExpStructure < SymbolType > && getRegExp ( ) &&;
+	virtual RegExpBase * clone ( ) const override;
 
 	/**
-	 * Sets the root node of the regular expression tree
-	 * @param regExp root node to set
+	 * @copydoc FormalRegExpElement::plunder() const
 	 */
-	void setRegExp ( FormalRegExpStructure < SymbolType > regExp );
+	virtual RegExpBase * plunder ( ) && override;
 
+	/**
+	 * Getter of the alphabet.
+	 *
+	 * \returns the alphabet of the expression
+	 */
 	const ext::set < SymbolType > & getAlphabet ( ) const & {
 		return this->template accessComponent < GeneralAlphabet > ( ).get ( );
 	}
 
+	/**
+	 * Getter of the alphabet.
+	 *
+	 * \returns the alphabet of the expression
+	 */
 	ext::set < SymbolType > & getAlphabet ( ) && {
 		return std::move ( this->template accessComponent < GeneralAlphabet > ( ).get ( ) );
 	}
 
 	/**
-	 * Prints XML representation of the RegExp to the output stream.
-	 * @param out output stream to which print the RegExp
-	 * @param regexp RegExp to print
+	 * Get the structure of the expression.
+	 *
+	 * \returns the structure of the expression.
+	 */
+	const FormalRegExpStructure < SymbolType > & getRegExp ( ) const &;
+
+	/**
+	 * Get the structure of the expression.
+	 *
+	 * \returns the structure of the expression.
 	 */
-	virtual void operator >>( std::ostream & out ) const;
+	FormalRegExpStructure < SymbolType > && getRegExp ( ) &&;
 
-	virtual int compare ( const ObjectBase & other ) const {
+	/**
+	 * Set the structure of the expression.
+	 *
+	 * \param regExp the new structure of the expression.
+	 */
+	void setRegExp ( FormalRegExpStructure < SymbolType > regExp );
+
+	/**
+	 * @copydoc alib::CommonBase<ObjectBase>::compare ( const ObjectBase & )
+	 */
+	virtual int compare ( const ObjectBase & other ) const override {
 		if ( ext::type_index ( typeid ( * this ) ) == ext::type_index ( typeid ( other ) ) ) return this->compare ( ( decltype ( * this ) )other );
 
 		return ext::type_index ( typeid ( * this ) ) - ext::type_index ( typeid ( other ) );
 	}
 
-	virtual int compare ( const FormalRegExp & other ) const;
+	/**
+	 * The actual compare method
+	 *
+	 * \param other the other instance
+	 *
+	 * \returns the actual relation between two by type same automata instances
+	 */
+	int compare ( const FormalRegExp & other ) const;
 
-	virtual explicit operator std::string ( ) const;
+	/**
+	 * @copydoc alib::CommonBase<ObjectBase>::operator >> ( std::ostream & )
+	 */
+	virtual void operator >>( std::ostream & out ) const override;
 
+	/**
+	 * @copydoc alib::CommonBase<ObjectBase>::operator std::string ( )
+	 */
+	virtual explicit operator std::string ( ) const override;
+
+	/**
+	 * \brief The XML tag name of class.
+	 *
+	 * \details Intentionaly a static member function to be safe in the initialisation before the main function starts.
+	 *
+	 * \returns string representing the XML tag name of the class
+	 */
 	static const std::string & getXmlTagName() {
 		static std::string xmlTagName = "FormalRegExp";
 
 		return xmlTagName;
 	}
 
+	/**
+	 * Parsing from a sequence of xml tokens helper.
+	 *
+	 * \params input the iterator to sequence of xml tokens to parse from
+	 *
+	 * \returns the new instance of the expression
+	 */
 	static FormalRegExp parse ( ext::deque < sax::Token >::iterator & input );
 
+	/**
+	 * Composing to a sequence of xml tokens helper.
+	 *
+	 * \param out the sink for new xml tokens representing the expression
+	 * \param regexp the expression to compose
+	 */
 	static void compose ( ext::deque < sax::Token > & out, const FormalRegExp & regexp );
 
-	virtual object::ObjectBase * inc ( ) &&;
+	/**
+	 * @copydoc alib::GrammarBase::inc()
+	 */
+	virtual object::ObjectBase * inc ( ) && override;
 
+	/**
+	 * Type of normalized expression.
+	 */
 	typedef FormalRegExp < > normalized_type;
 };
 
@@ -219,21 +316,53 @@ object::ObjectBase* FormalRegExp < SymbolType >::inc() && {
 
 namespace core {
 
+/**
+ * Helper class specifying constraints for the expression's internal alphabet component.
+ *
+ * \tparam SymbolType used for the terminal alphabet of the expression.
+ */
 template < class SymbolType >
 class SetConstraint< regexp::FormalRegExp < SymbolType >, SymbolType, regexp::GeneralAlphabet > {
 public:
+	/**
+	 * Returns true if the symbol is still used somewhere in the structure of the expression.
+	 *
+	 * \param regexp the tested expresion
+	 * \param symbol the tested symbol
+	 *
+	 * \returns true if the symbol is used, false othervise
+	 */
 	static bool used ( const regexp::FormalRegExp < SymbolType > & regexp, const SymbolType & symbol ) {
 		return regexp.getRegExp ( ).getStructure ( ).testSymbol ( symbol );
 	}
 
+	/**
+	 * Returns true as all symbols are possibly available to be elements of the alphabet.
+	 *
+	 * \param regexp the tested expresion
+	 * \param symbol the tested state
+	 *
+	 * \returns true
+	 */
 	static bool available ( const regexp::FormalRegExp < SymbolType > &, const SymbolType & ) {
 		return true;
 	}
 
+	/**
+	 * All symbols are valid as symbols of the alphabet.
+	 *
+	 * \param regexp the tested expresion
+	 * \param symbol the tested state
+	 */
 	static void valid ( const regexp::FormalRegExp < SymbolType > &, const SymbolType & ) {
 	}
 };
 
+/**
+ * Helper for normalisation of types specified by templates used as internal datatypes of symbols.
+ *
+ * \returns new instance of the expression with default template parameters or unmodified instance if the template parameters were already the default ones
+ */
 template < class SymbolType >
 struct normalize < regexp::FormalRegExp < SymbolType >, typename std::enable_if < ! std::is_same < regexp::FormalRegExp < SymbolType >, regexp::FormalRegExp < > >::value >::type > {
 	static regexp::FormalRegExp < > eval ( regexp::FormalRegExp < SymbolType > && value ) {
diff --git a/alib2data/src/regexp/unbounded/UnboundedRegExp.h b/alib2data/src/regexp/unbounded/UnboundedRegExp.h
index c703b55a89dfe9b9d0b76784418b4626831052e0..508ba311bf9d46ab9b264b9eed95618387647382 100644
--- a/alib2data/src/regexp/unbounded/UnboundedRegExp.h
+++ b/alib2data/src/regexp/unbounded/UnboundedRegExp.h
@@ -106,7 +106,7 @@ public:
 	/**
 	 * Getter of the alphabet.
 	 *
-	 * \returns the alphabet of the automaton
+	 * \returns the alphabet of the expression
 	 */
 	const ext::set < SymbolType > & getAlphabet ( ) const & {
 		return this->template accessComponent < GeneralAlphabet > ( ).get ( );
@@ -115,7 +115,7 @@ public:
 	/**
 	 * Getter of the alphabet.
 	 *
-	 * \returns the alphabet of the automaton
+	 * \returns the alphabet of the expression
 	 */
 	ext::set < SymbolType > && getAlphabet ( ) && {
 		return std::move ( this->template accessComponent < GeneralAlphabet > ( ).get ( ) );
@@ -206,7 +206,7 @@ public:
 	virtual object::ObjectBase * inc ( ) && override;
 
 	/**
-	 * Type of normalized automaton.
+	 * Type of normalized expression.
 	 */
 	typedef UnboundedRegExp < > normalized_type;
 };
@@ -317,9 +317,9 @@ object::ObjectBase* UnboundedRegExp < SymbolType >::inc() && {
 namespace core {
 
 /**
- * Helper class specifying constraints for the automaton's internal alphabet component.
+ * Helper class specifying constraints for the expression's internal alphabet component.
  *
- * \tparam SymbolType used for the terminal alphabet of the automaton.
+ * \tparam SymbolType used for the terminal alphabet of the expression.
  */
 template < class SymbolType >
 class SetConstraint< regexp::UnboundedRegExp < SymbolType >, SymbolType, regexp::GeneralAlphabet > {