diff --git a/alib2data/src/grammar/AddRawRule.h b/alib2data/src/grammar/AddRawRule.h
index eca767dcb9538396f344ead684fa9b600e35ac38..9814d66953f135f280d328cdd821e667ef261010 100644
--- a/alib2data/src/grammar/AddRawRule.h
+++ b/alib2data/src/grammar/AddRawRule.h
@@ -32,7 +32,6 @@ public:
 	/**
 	 * Get rules in most common format of rules as mapping from leftHandSide to rightHandSides represented as vectors of symbols.
 	 *
-	 * \tparam SymbolType the type of symbols in the grammar
 	 * \tparam TerminalSymbolType the type of terminal symbols in the grammar
 	 * \tparam NonterminalSymbolType the type of nontermnal symbols in the grammar
 	 *
@@ -40,8 +39,8 @@ public:
 	 *
 	 * \returns rules of the grammar in a common representation
 	 */
-	template < class SymbolType, class TerminalSymbolType, class NonterminalSymbolType >
-	static bool addRawRule ( LG < SymbolType > & grammar, NonterminalSymbolType leftHandSide, ext::vector < ext::variant < TerminalSymbolType, NonterminalSymbolType > > rightHandSide );
+	template < class TerminalSymbolType, class NonterminalSymbolType >
+	static bool addRawRule ( LG < TerminalSymbolType, NonterminalSymbolType > & grammar, NonterminalSymbolType leftHandSide, ext::vector < ext::variant < TerminalSymbolType, NonterminalSymbolType > > rightHandSide );
 
 	/**
 	 * \override
@@ -92,8 +91,8 @@ public:
 	static bool addRawRule ( RightRG < TerminalSymbolType, NonterminalSymbolType > & grammar, NonterminalSymbolType leftHandSide, ext::vector < ext::variant < TerminalSymbolType, NonterminalSymbolType > > rightHandSide );
 };
 
-template < class SymbolType, class TerminalSymbolType, class NonterminalSymbolType >
-bool AddRawRule::addRawRule ( LG < SymbolType > & grammar, NonterminalSymbolType leftHandSide, ext::vector < ext::variant < TerminalSymbolType, NonterminalSymbolType > > rightHandSide ) {
+template < class TerminalSymbolType, class NonterminalSymbolType >
+bool AddRawRule::addRawRule ( LG < TerminalSymbolType, NonterminalSymbolType > & grammar, NonterminalSymbolType leftHandSide, ext::vector < ext::variant < TerminalSymbolType, NonterminalSymbolType > > rightHandSide ) {
 	typename ext::vector < ext::variant < TerminalSymbolType, NonterminalSymbolType > >::iterator nonterminalPosition = rightHandSide.begin ( );
 
 	for ( ; nonterminalPosition != rightHandSide.end ( ); ++nonterminalPosition )
diff --git a/alib2data/src/grammar/ContextFree/LG.h b/alib2data/src/grammar/ContextFree/LG.h
index 858a033bd0602f8ecc5bf582b79c5e9f1dc3d310..84c77f129d05496393426092513134da72cf7b8e 100644
--- a/alib2data/src/grammar/ContextFree/LG.h
+++ b/alib2data/src/grammar/ContextFree/LG.h
@@ -62,14 +62,15 @@ class InitialSymbol;
  * P = set of production rules of the form A -> B, where A \in N and B \in ( N \cup T )*,
  * S (InitialSymbol) = initial nonterminal symbol,
  *
- * \tparam SymbolType used for the terminal alphabet, the nonterminal alphabet, and the initial symbol of the grammar.
+ * \tparam TerminalSymbolType used for the terminal alphabet of the grammar.
+ * \tparam NonterminalSymbolType used for the nonterminal alphabet, and the initial symbol of the grammar.
  */
-template < class SymbolType = DefaultSymbolType >
-class LG final : public GrammarBase, public core::Components < LG < SymbolType >, ext::set < SymbolType >, component::Set, std::tuple < TerminalAlphabet, NonterminalAlphabet >, SymbolType, component::Value, InitialSymbol > {
+template < class TerminalSymbolType = DefaultSymbolType, class NonterminalSymbolType = DefaultSymbolType >
+class LG final : public GrammarBase, public core::Components < LG < TerminalSymbolType, NonterminalSymbolType >, ext::set < TerminalSymbolType >, component::Set, TerminalAlphabet, ext::set < NonterminalSymbolType >, component::Set, NonterminalAlphabet, NonterminalSymbolType, component::Value, InitialSymbol > {
 	/**
 	 * Rules function as mapping from nonterminal symbol on the left hand side to a set of sequences of terminal and nonterminal symbols.
 	 */
-	ext::map < SymbolType, ext::set < ext::variant < ext::vector < SymbolType >, ext::tuple < ext::vector < SymbolType >, SymbolType, ext::vector < SymbolType > > > > > rules;
+	ext::map < NonterminalSymbolType, ext::set < ext::variant < ext::vector < TerminalSymbolType >, ext::tuple < ext::vector < TerminalSymbolType >, NonterminalSymbolType, ext::vector < TerminalSymbolType > > > > > rules;
 
 public:
 	/**
@@ -77,7 +78,7 @@ public:
 	 *
 	 * \param initialSymbol the initial symbol of the grammar
 	 */
-	explicit LG ( SymbolType initialSymbol );
+	explicit LG ( NonterminalSymbolType initialSymbol );
 
 	/**
 	 * \brief Creates a new instance of the grammar with a concrete nonterminal alphabet, terminal alphabet and initial symbol.
@@ -86,7 +87,7 @@ public:
 	 * \param terminalSymbols the initial terminal alphabet
 	 * \param initialSymbol the initial symbol of the grammar
 	 */
-	explicit LG ( ext::set < SymbolType > nonTerminalSymbols, ext::set < SymbolType > terminalSymbols, SymbolType initialSymbol );
+	explicit LG ( ext::set < NonterminalSymbolType > nonTerminalSymbols, ext::set < TerminalSymbolType > terminalSymbols, NonterminalSymbolType initialSymbol );
 
 	/**
 	 * @copydoc grammar::GrammarBase::clone()
@@ -108,7 +109,7 @@ public:
 	 *
 	 * \returns true if the rule was indeed added, false othervise
 	 */
-	bool addRule ( SymbolType leftHandSide, ext::variant < ext::vector < SymbolType >, ext::tuple < ext::vector < SymbolType >, SymbolType, ext::vector < SymbolType > > > rightHandSide );
+	bool addRule ( NonterminalSymbolType leftHandSide, ext::variant < ext::vector < TerminalSymbolType >, ext::tuple < ext::vector < TerminalSymbolType >, NonterminalSymbolType, ext::vector < TerminalSymbolType > > > rightHandSide );
 
 	/**
 	 * \brief Add a new rule of a grammar.
@@ -120,7 +121,7 @@ public:
 	 *
 	 * \returns true if the rule was indeed added, false othervise
 	 */
-	bool addRule ( SymbolType leftHandSide, ext::vector < SymbolType > rightHandSide );
+	bool addRule ( NonterminalSymbolType leftHandSide, ext::vector < TerminalSymbolType > rightHandSide );
 
 	/**
 	 * \brief Add a new rule of a grammar.
@@ -132,7 +133,7 @@ public:
 	 *
 	 * \returns true if the rule was indeed added, false othervise
 	 */
-	bool addRule ( SymbolType leftHandSide, ext::tuple < ext::vector < SymbolType >, SymbolType, ext::vector < SymbolType > > rightHandSide );
+	bool addRule ( NonterminalSymbolType leftHandSide, ext::tuple < ext::vector < TerminalSymbolType >, NonterminalSymbolType, ext::vector < TerminalSymbolType > > rightHandSide );
 
 	/**
 	 * \brief Add new rules of a grammar.
@@ -142,21 +143,21 @@ public:
 	 * \param leftHandSide the left hand side of the rule
 	 * \param rightHandSide a set of right hand sides of the rule
 	 */
-	void addRules ( SymbolType leftHandSide, ext::set < ext::variant < ext::vector < SymbolType >, ext::tuple < ext::vector < SymbolType >, SymbolType, ext::vector < SymbolType > > > > rightHandSide );
+	void addRules ( NonterminalSymbolType leftHandSide, ext::set < ext::variant < ext::vector < TerminalSymbolType >, ext::tuple < ext::vector < TerminalSymbolType >, NonterminalSymbolType, ext::vector < TerminalSymbolType > > > > rightHandSide );
 
 	/**
 	 * Get rules of the grammar.
 	 *
 	 * \returns rules of the grammar
 	 */
-	const ext::map < SymbolType, ext::set < ext::variant < ext::vector < SymbolType >, ext::tuple < ext::vector < SymbolType >, SymbolType, ext::vector < SymbolType > > > > > & getRules ( ) const &;
+	const ext::map < NonterminalSymbolType, ext::set < ext::variant < ext::vector < TerminalSymbolType >, ext::tuple < ext::vector < TerminalSymbolType >, NonterminalSymbolType, ext::vector < TerminalSymbolType > > > > > & getRules ( ) const &;
 
 	/**
 	 * Get rules of the grammar.
 	 *
 	 * \returns rules of the grammar
 	 */
-	ext::map < SymbolType, ext::set < ext::variant < ext::vector < SymbolType >, ext::tuple < ext::vector < SymbolType >, SymbolType, ext::vector < SymbolType > > > > > && getRules ( ) &&;
+	ext::map < NonterminalSymbolType, ext::set < ext::variant < ext::vector < TerminalSymbolType >, ext::tuple < ext::vector < TerminalSymbolType >, NonterminalSymbolType, ext::vector < TerminalSymbolType > > > > > && getRules ( ) &&;
 
 	/**
 	 * Remove a rule of a grammar in form of A -> aBb or A -> a, where A, B \in N and a, b \in T*.
@@ -166,7 +167,7 @@ public:
 	 *
 	 * \returns true if the rule was indeed removed, false othervise
 	 */
-	bool removeRule ( const SymbolType & leftHandSide, const ext::variant < ext::vector < SymbolType >, ext::tuple < ext::vector < SymbolType >, SymbolType, ext::vector < SymbolType > > > & rightHandSide );
+	bool removeRule ( const NonterminalSymbolType & leftHandSide, const ext::variant < ext::vector < TerminalSymbolType >, ext::tuple < ext::vector < TerminalSymbolType >, NonterminalSymbolType, ext::vector < TerminalSymbolType > > > & rightHandSide );
 
 	/**
 	 * Remove a rule of a grammar in form of A -> a, where A \in N and a \in T*.
@@ -176,7 +177,7 @@ public:
 	 *
 	 * \returns true if the rule was indeed removed, false othervise
 	 */
-	bool removeRule ( const SymbolType & leftHandSide, const ext::vector < SymbolType > & rightHandSide );
+	bool removeRule ( const NonterminalSymbolType & leftHandSide, const ext::vector < TerminalSymbolType > & rightHandSide );
 
 	/**
 	 * Remove a rule of a grammar in form of A -> aBb, where A, B \in N and a, b \in T*.
@@ -186,14 +187,14 @@ public:
 	 *
 	 * \returns true if the rule was indeed removed, false othervise
 	 */
-	bool removeRule ( const SymbolType & leftHandSide, const ext::tuple < ext::vector < SymbolType >, SymbolType, ext::vector < SymbolType > > & rightHandSide );
+	bool removeRule ( const NonterminalSymbolType & leftHandSide, const ext::tuple < ext::vector < TerminalSymbolType >, NonterminalSymbolType, ext::vector < TerminalSymbolType > > & rightHandSide );
 
 	/**
 	 * Getter of initial symbol.
 	 *
 	 * \returns the initial symbol of the grammar
 	 */
-	const SymbolType & getInitialSymbol ( ) const & {
+	const NonterminalSymbolType & getInitialSymbol ( ) const & {
 		return this->template accessComponent < InitialSymbol > ( ).get ( );
 	}
 
@@ -202,7 +203,7 @@ public:
 	 *
 	 * \returns the initial symbol of the grammar
 	 */
-	SymbolType && getInitialSymbol ( ) && {
+	NonterminalSymbolType && getInitialSymbol ( ) && {
 		return std::move ( this->template accessComponent < InitialSymbol > ( ).get ( ) );
 	}
 
@@ -213,7 +214,7 @@ public:
 	 *
 	 * \returns true if the initial symbol was indeed changed
 	 */
-	bool setInitialSymbol ( SymbolType symbol ) {
+	bool setInitialSymbol ( NonterminalSymbolType symbol ) {
 		return this->template accessComponent < InitialSymbol > ( ).set ( std::move ( symbol ) );
 	}
 
@@ -222,7 +223,7 @@ public:
 	 *
 	 * \returns the nonterminal alphabet of the grammar
 	 */
-	const ext::set < SymbolType > & getNonterminalAlphabet ( ) const & {
+	const ext::set < NonterminalSymbolType > & getNonterminalAlphabet ( ) const & {
 		return this->template accessComponent < NonterminalAlphabet > ( ).get ( );
 	}
 
@@ -231,7 +232,7 @@ public:
 	 *
 	 * \returns the nonterminal alphabet of the grammar
 	 */
-	ext::set < SymbolType > && getNonterminalAlphabet ( ) && {
+	ext::set < NonterminalSymbolType > && getNonterminalAlphabet ( ) && {
 		return std::move ( this->template accessComponent < NonterminalAlphabet > ( ).get ( ) );
 	}
 
@@ -242,7 +243,7 @@ public:
 	 *
 	 * \returns true if the symbol was indeed added
 	 */
-	bool addNonterminalSymbol ( SymbolType symbol ) {
+	bool addNonterminalSymbol ( NonterminalSymbolType symbol ) {
 		return this->template accessComponent < NonterminalAlphabet > ( ).add ( std::move ( symbol ) );
 	}
 
@@ -251,7 +252,7 @@ public:
 	 *
 	 * \param symbols completely new nonterminal alphabet
 	 */
-	void setNonterminalAlphabet ( ext::set < SymbolType > symbols ) {
+	void setNonterminalAlphabet ( ext::set < NonterminalSymbolType > symbols ) {
 		this->template accessComponent < NonterminalAlphabet > ( ).set ( std::move ( symbols ) );
 	}
 
@@ -260,7 +261,7 @@ public:
 	 *
 	 * \returns the terminal alphabet of the grammar
 	 */
-	const ext::set < SymbolType > & getTerminalAlphabet ( ) const & {
+	const ext::set < TerminalSymbolType > & getTerminalAlphabet ( ) const & {
 		return this->template accessComponent < TerminalAlphabet > ( ).get ( );
 	}
 
@@ -269,7 +270,7 @@ public:
 	 *
 	 * \returns the terminal alphabet of the grammar
 	 */
-	ext::set < SymbolType > && getTerminalAlphabet ( ) && {
+	ext::set < TerminalSymbolType > && getTerminalAlphabet ( ) && {
 		return std::move ( this->template accessComponent < TerminalAlphabet > ( ).get ( ) );
 	}
 
@@ -280,7 +281,7 @@ public:
 	 *
 	 * \returns true if the symbol was indeed added
 	 */
-	bool addTerminalSymbol ( SymbolType symbol ) {
+	bool addTerminalSymbol ( TerminalSymbolType symbol ) {
 		return this->template accessComponent < TerminalAlphabet > ( ).add ( std::move ( symbol ) );
 	}
 
@@ -289,7 +290,7 @@ public:
 	 *
 	 * \param symbol completely new nontemrinal alphabet
 	 */
-	void setTerminalAlphabet ( ext::set < SymbolType > symbols ) {
+	void setTerminalAlphabet ( ext::set < TerminalSymbolType > symbols ) {
 		this->template accessComponent < TerminalAlphabet > ( ).set ( std::move ( symbols ) );
 	}
 
@@ -327,46 +328,46 @@ public:
 	virtual object::ObjectBase * inc ( ) && override;
 };
 
-template < class SymbolType >
-LG < SymbolType >::LG ( SymbolType initialSymbol ) : LG ( ext::set < SymbolType > { initialSymbol }, ext::set < SymbolType > ( ), initialSymbol ) {
+template < class TerminalSymbolType, class NonterminalSymbolType >
+LG < TerminalSymbolType, NonterminalSymbolType >::LG ( NonterminalSymbolType initialSymbol ) : LG ( ext::set < NonterminalSymbolType > { initialSymbol }, ext::set < TerminalSymbolType > ( ), initialSymbol ) {
 }
 
-template < class SymbolType >
-LG < SymbolType >::LG ( ext::set < SymbolType > nonterminalAlphabet, ext::set < SymbolType > terminalAlphabet, SymbolType initialSymbol ) : core::Components < LG, ext::set < SymbolType >, component::Set, std::tuple < TerminalAlphabet, NonterminalAlphabet >, SymbolType, component::Value, InitialSymbol > ( std::move ( terminalAlphabet), std::move ( nonterminalAlphabet ), std::move ( initialSymbol ) ) {
+template < class TerminalSymbolType, class NonterminalSymbolType >
+LG < TerminalSymbolType, NonterminalSymbolType >::LG ( ext::set < NonterminalSymbolType > nonterminalAlphabet, ext::set < TerminalSymbolType > terminalAlphabet, NonterminalSymbolType initialSymbol ) : core::Components < LG, ext::set < TerminalSymbolType >, component::Set, TerminalAlphabet, ext::set < NonterminalSymbolType >, component::Set, NonterminalAlphabet, NonterminalSymbolType, component::Value, InitialSymbol > ( std::move ( terminalAlphabet), std::move ( nonterminalAlphabet ), std::move ( initialSymbol ) ) {
 }
 
-template < class SymbolType >
-GrammarBase * LG < SymbolType >::clone ( ) const & {
+template < class TerminalSymbolType, class NonterminalSymbolType >
+GrammarBase * LG < TerminalSymbolType, NonterminalSymbolType >::clone ( ) const & {
 	return new LG ( * this );
 }
 
-template < class SymbolType >
-GrammarBase * LG < SymbolType >::clone ( ) && {
+template < class TerminalSymbolType, class NonterminalSymbolType >
+GrammarBase * LG < TerminalSymbolType, NonterminalSymbolType >::clone ( ) && {
 	return new LG ( std::move ( * this ) );
 }
 
-template < class SymbolType >
-bool LG < SymbolType >::addRule ( SymbolType leftHandSide, ext::variant < ext::vector < SymbolType >, ext::tuple < ext::vector < SymbolType >, SymbolType, ext::vector < SymbolType > > > rightHandSide ) {
+template < class TerminalSymbolType, class NonterminalSymbolType >
+bool LG < TerminalSymbolType, NonterminalSymbolType >::addRule ( NonterminalSymbolType leftHandSide, ext::variant < ext::vector < TerminalSymbolType >, ext::tuple < ext::vector < TerminalSymbolType >, NonterminalSymbolType, ext::vector < TerminalSymbolType > > > rightHandSide ) {
 	if ( !getNonterminalAlphabet ( ).count ( leftHandSide ) )
 		throw GrammarException ( "Rule must rewrite nonterminal symbol" );
 
-	if ( rightHandSide.template is < ext::vector < SymbolType > > ( ) ) {
-		const ext::vector < SymbolType > & rhs = rightHandSide.template get < ext::vector < SymbolType > > ( );
+	if ( rightHandSide.template is < ext::vector < TerminalSymbolType > > ( ) ) {
+		const ext::vector < TerminalSymbolType > & rhs = rightHandSide.template get < ext::vector < TerminalSymbolType > > ( );
 
-		for ( const SymbolType & symbol : rhs )
+		for ( const TerminalSymbolType & symbol : rhs )
 			if ( !getTerminalAlphabet ( ).count ( symbol ) )
 				throw GrammarException ( "Symbol " + ext::to_string ( symbol ) + " is not a terminal symbol" );
 	} else {
-		const ext::tuple < ext::vector < SymbolType >, SymbolType, ext::vector < SymbolType > > & rhs = rightHandSide.template get < ext::tuple < ext::vector < SymbolType >, SymbolType, ext::vector < SymbolType > > > ( );
+		const ext::tuple < ext::vector < TerminalSymbolType >, NonterminalSymbolType, ext::vector < TerminalSymbolType > > & rhs = rightHandSide.template get < ext::tuple < ext::vector < TerminalSymbolType >, NonterminalSymbolType, ext::vector < TerminalSymbolType > > > ( );
 
-		for ( const SymbolType & symbol : std::get < 0 > ( rhs ) )
+		for ( const TerminalSymbolType & symbol : std::get < 0 > ( rhs ) )
 			if ( !getTerminalAlphabet ( ).count ( symbol ) )
 				throw GrammarException ( "Symbol " + ext::to_string ( symbol ) + " is not a terminal symbol" );
 
 		if ( !getNonterminalAlphabet ( ).count ( std::get < 1 > ( rhs ) ) )
 			throw GrammarException ( "Symbol " + ext::to_string ( std::get < 1 > ( rhs ) ) + " is not a nonterminal symbol" );
 
-		for ( const SymbolType & symbol : std::get < 2 > ( rhs ) )
+		for ( const TerminalSymbolType & symbol : std::get < 2 > ( rhs ) )
 			if ( !getTerminalAlphabet ( ).count ( symbol ) )
 				throw GrammarException ( "Symbol " + ext::to_string ( symbol ) + " is not a terminal symbol" );
 	}
@@ -374,43 +375,43 @@ bool LG < SymbolType >::addRule ( SymbolType leftHandSide, ext::variant < ext::v
 	return rules[std::move ( leftHandSide )].insert ( std::move ( rightHandSide ) ).second;
 }
 
-template < class SymbolType >
-bool LG < SymbolType >::addRule ( SymbolType leftHandSide, ext::vector < SymbolType > rightHandSide ) {
-	ext::variant < ext::vector < SymbolType >, ext::tuple < ext::vector < SymbolType >, SymbolType, ext::vector < SymbolType > > > rhs ( std::move ( rightHandSide ) );
+template < class TerminalSymbolType, class NonterminalSymbolType >
+bool LG < TerminalSymbolType, NonterminalSymbolType >::addRule ( NonterminalSymbolType leftHandSide, ext::vector < TerminalSymbolType > rightHandSide ) {
+	ext::variant < ext::vector < TerminalSymbolType >, ext::tuple < ext::vector < TerminalSymbolType >, NonterminalSymbolType, ext::vector < TerminalSymbolType > > > rhs ( std::move ( rightHandSide ) );
 
 	return addRule ( std::move ( leftHandSide ), std::move ( rhs ) );
 }
 
-template < class SymbolType >
-bool LG < SymbolType >::addRule ( SymbolType leftHandSide, ext::tuple < ext::vector < SymbolType >, SymbolType, ext::vector < SymbolType > > rightHandSide ) {
-	ext::variant < ext::vector < SymbolType >, ext::tuple < ext::vector < SymbolType >, SymbolType, ext::vector < SymbolType > > > rhs ( std::move ( rightHandSide ) );
+template < class TerminalSymbolType, class NonterminalSymbolType >
+bool LG < TerminalSymbolType, NonterminalSymbolType >::addRule ( NonterminalSymbolType leftHandSide, ext::tuple < ext::vector < TerminalSymbolType >, NonterminalSymbolType, ext::vector < TerminalSymbolType > > rightHandSide ) {
+	ext::variant < ext::vector < TerminalSymbolType >, ext::tuple < ext::vector < TerminalSymbolType >, NonterminalSymbolType, ext::vector < TerminalSymbolType > > > rhs ( std::move ( rightHandSide ) );
 
 	return addRule ( std::move ( leftHandSide ), std::move ( rhs ) );
 }
 
-template < class SymbolType >
-void LG < SymbolType >::addRules ( SymbolType leftHandSide, ext::set < ext::variant < ext::vector < SymbolType >, ext::tuple < ext::vector < SymbolType >, SymbolType, ext::vector < SymbolType > > > > rightHandSide ) {
+template < class TerminalSymbolType, class NonterminalSymbolType >
+void LG < TerminalSymbolType, NonterminalSymbolType >::addRules ( NonterminalSymbolType leftHandSide, ext::set < ext::variant < ext::vector < TerminalSymbolType >, ext::tuple < ext::vector < TerminalSymbolType >, NonterminalSymbolType, ext::vector < TerminalSymbolType > > > > rightHandSide ) {
 	if ( !getNonterminalAlphabet ( ).count ( leftHandSide ) )
 		throw GrammarException ( "Rule must rewrite nonterminal symbol" );
 
-	for ( const ext::variant < ext::vector < SymbolType >, ext::tuple < ext::vector < SymbolType >, SymbolType, ext::vector < SymbolType > > > & element : rightHandSide ) {
-		if ( element.template is < ext::vector < SymbolType > > ( ) ) {
-			const ext::vector < SymbolType > & rhs = element.template get < ext::vector < SymbolType > > ( );
+	for ( const ext::variant < ext::vector < TerminalSymbolType >, ext::tuple < ext::vector < TerminalSymbolType >, NonterminalSymbolType, ext::vector < TerminalSymbolType > > > & element : rightHandSide ) {
+		if ( element.template is < ext::vector < TerminalSymbolType > > ( ) ) {
+			const ext::vector < TerminalSymbolType > & rhs = element.template get < ext::vector < TerminalSymbolType > > ( );
 
-			for ( const SymbolType & symbol : rhs )
+			for ( const TerminalSymbolType & symbol : rhs )
 				if ( !getTerminalAlphabet ( ).count ( symbol ) )
 					throw GrammarException ( "Symbol " + ext::to_string ( symbol ) + " is not a terminal symbol" );
 		} else {
-			const ext::tuple < ext::vector < SymbolType >, SymbolType, ext::vector < SymbolType > > & rhs = element.template get < ext::tuple < ext::vector < SymbolType >, SymbolType, ext::vector < SymbolType > > > ( );
+			const ext::tuple < ext::vector < TerminalSymbolType >, NonterminalSymbolType, ext::vector < TerminalSymbolType > > & rhs = element.template get < ext::tuple < ext::vector < TerminalSymbolType >, NonterminalSymbolType, ext::vector < TerminalSymbolType > > > ( );
 
-			for ( const SymbolType & symbol : std::get < 0 > ( rhs ) )
+			for ( const TerminalSymbolType & symbol : std::get < 0 > ( rhs ) )
 				if ( !getTerminalAlphabet ( ).count ( symbol ) )
 					throw GrammarException ( "Symbol " + ext::to_string ( symbol ) + " is not a terminal symbol" );
 
 			if ( !getNonterminalAlphabet ( ).count ( std::get < 1 > ( rhs ) ) )
 				throw GrammarException ( "Symbol " + ext::to_string ( std::get < 1 > ( rhs ) ) + " is not a nonterminal symbol" );
 
-			for ( const SymbolType & symbol : std::get < 2 > ( rhs ) )
+			for ( const TerminalSymbolType & symbol : std::get < 2 > ( rhs ) )
 				if ( !getTerminalAlphabet ( ).count ( symbol ) )
 					throw GrammarException ( "Symbol " + ext::to_string ( symbol ) + " is not a terminal symbol" );
 		}
@@ -419,37 +420,37 @@ void LG < SymbolType >::addRules ( SymbolType leftHandSide, ext::set < ext::vari
 	rules [ std::move ( leftHandSide ) ].insert ( ext::make_mover ( rightHandSide ).begin ( ), ext::make_mover ( rightHandSide ).end ( ) );
 }
 
-template < class SymbolType >
-const ext::map < SymbolType, ext::set < ext::variant < ext::vector < SymbolType >, ext::tuple < ext::vector < SymbolType >, SymbolType, ext::vector < SymbolType > > > > > & LG < SymbolType >::getRules ( ) const & {
+template < class TerminalSymbolType, class NonterminalSymbolType >
+const ext::map < NonterminalSymbolType, ext::set < ext::variant < ext::vector < TerminalSymbolType >, ext::tuple < ext::vector < TerminalSymbolType >, NonterminalSymbolType, ext::vector < TerminalSymbolType > > > > > & LG < TerminalSymbolType, NonterminalSymbolType >::getRules ( ) const & {
 	return rules;
 }
 
-template < class SymbolType >
-ext::map < SymbolType, ext::set < ext::variant < ext::vector < SymbolType >, ext::tuple < ext::vector < SymbolType >, SymbolType, ext::vector < SymbolType > > > > > && LG < SymbolType >::getRules ( ) && {
+template < class TerminalSymbolType, class NonterminalSymbolType >
+ext::map < NonterminalSymbolType, ext::set < ext::variant < ext::vector < TerminalSymbolType >, ext::tuple < ext::vector < TerminalSymbolType >, NonterminalSymbolType, ext::vector < TerminalSymbolType > > > > > && LG < TerminalSymbolType, NonterminalSymbolType >::getRules ( ) && {
 	return std::move ( rules );
 }
 
-template < class SymbolType >
-bool LG < SymbolType >::removeRule ( const SymbolType & leftHandSide, const ext::variant < ext::vector < SymbolType >, ext::tuple < ext::vector < SymbolType >, SymbolType, ext::vector < SymbolType > > > & rightHandSide ) {
+template < class TerminalSymbolType, class NonterminalSymbolType >
+bool LG < TerminalSymbolType, NonterminalSymbolType >::removeRule ( const NonterminalSymbolType & leftHandSide, const ext::variant < ext::vector < TerminalSymbolType >, ext::tuple < ext::vector < TerminalSymbolType >, NonterminalSymbolType, ext::vector < TerminalSymbolType > > > & rightHandSide ) {
 	return rules[leftHandSide].erase ( rightHandSide );
 }
 
-template < class SymbolType >
-bool LG < SymbolType >::removeRule ( const SymbolType & leftHandSide, const ext::vector < SymbolType > & rightHandSide ) {
-	ext::variant < ext::vector < SymbolType >, ext::tuple < ext::vector < SymbolType >, SymbolType, ext::vector < SymbolType > > > rhs ( rightHandSide );
+template < class TerminalSymbolType, class NonterminalSymbolType >
+bool LG < TerminalSymbolType, NonterminalSymbolType >::removeRule ( const NonterminalSymbolType & leftHandSide, const ext::vector < TerminalSymbolType > & rightHandSide ) {
+	ext::variant < ext::vector < TerminalSymbolType >, ext::tuple < ext::vector < TerminalSymbolType >, NonterminalSymbolType, ext::vector < TerminalSymbolType > > > rhs ( rightHandSide );
 
 	return removeRule ( leftHandSide, rhs );
 }
 
-template < class SymbolType >
-bool LG < SymbolType >::removeRule ( const SymbolType & leftHandSide, const ext::tuple < ext::vector < SymbolType >, SymbolType, ext::vector < SymbolType > > & rightHandSide ) {
-	ext::variant < ext::vector < SymbolType >, ext::tuple < ext::vector < SymbolType >, SymbolType, ext::vector < SymbolType > > > rhs ( rightHandSide );
+template < class TerminalSymbolType, class NonterminalSymbolType >
+bool LG < TerminalSymbolType, NonterminalSymbolType >::removeRule ( const NonterminalSymbolType & leftHandSide, const ext::tuple < ext::vector < TerminalSymbolType >, NonterminalSymbolType, ext::vector < TerminalSymbolType > > & rightHandSide ) {
+	ext::variant < ext::vector < TerminalSymbolType >, ext::tuple < ext::vector < TerminalSymbolType >, NonterminalSymbolType, ext::vector < TerminalSymbolType > > > rhs ( rightHandSide );
 
 	return removeRule ( leftHandSide, rhs );
 }
 
-template < class SymbolType >
-int LG < SymbolType >::compare ( const LG & other ) const {
+template < class TerminalSymbolType, class NonterminalSymbolType >
+int LG < TerminalSymbolType, NonterminalSymbolType >::compare ( const LG & other ) const {
 	auto first = ext::tie ( getTerminalAlphabet ( ), getNonterminalAlphabet ( ), getInitialSymbol ( ), rules );
 	auto second = ext::tie ( other.getTerminalAlphabet ( ), other.getNonterminalAlphabet ( ), other.getInitialSymbol ( ), other.rules );
 
@@ -458,8 +459,8 @@ int LG < SymbolType >::compare ( const LG & other ) const {
 	return comp ( first, second );
 }
 
-template < class SymbolType >
-void LG < SymbolType >::operator >>( std::ostream & out ) const {
+template < class TerminalSymbolType, class NonterminalSymbolType >
+void LG < TerminalSymbolType, NonterminalSymbolType >::operator >>( std::ostream & out ) const {
 	out << "(LG "
 	    << "nonterminalAlphabet = " << getNonterminalAlphabet ( )
 	    << "terminalAlphabet = " << getTerminalAlphabet ( )
@@ -467,15 +468,15 @@ void LG < SymbolType >::operator >>( std::ostream & out ) const {
 	    << "rules = " << rules << ")";
 }
 
-template < class SymbolType >
-LG < SymbolType >::operator std::string ( ) const {
+template < class TerminalSymbolType, class NonterminalSymbolType >
+LG < TerminalSymbolType, NonterminalSymbolType >::operator std::string ( ) const {
 	std::stringstream ss;
 	ss << * this;
 	return ss.str ( );
 }
 
-template < class SymbolType >
-object::ObjectBase* LG < SymbolType >::inc() && {
+template < class TerminalSymbolType, class NonterminalSymbolType >
+object::ObjectBase* LG < TerminalSymbolType, NonterminalSymbolType >::inc() && {
 	return new object::UniqueObject(object::Object(std::move(*this)), primitive::Integer(0));
 }
 
@@ -486,10 +487,11 @@ namespace core {
 /**
  * Helper class specifying constraints for the grammar's internal terminal alphabet component.
  *
- * \tparam SymbolType used for the terminal alphabet of the grammar.
+ * \tparam TerminalSymbolType used for the terminal alphabet of the grammar.
+ * \tparam NonterminalSymbolType used for the nonterminal alphabet, and the initial symbol of the grammar.
  */
-template < class SymbolType >
-class SetConstraint< grammar::LG < SymbolType >, SymbolType, grammar::TerminalAlphabet > {
+template < class TerminalSymbolType, class NonterminalSymbolType >
+class SetConstraint< grammar::LG < TerminalSymbolType, NonterminalSymbolType >, TerminalSymbolType, grammar::TerminalAlphabet > {
 public:
 	/**
 	 * Returns true if the terminal symbol is still used in some rule of the grammar.
@@ -499,23 +501,23 @@ public:
 	 *
 	 * \returns true if the symbol is used, false othervise
 	 */
-	static bool used ( const grammar::LG < SymbolType > & grammar, const SymbolType & symbol ) {
-		for ( const std::pair < const SymbolType, ext::set < ext::variant < ext::vector < SymbolType >, ext::tuple < ext::vector < SymbolType >, SymbolType, ext::vector < SymbolType > > > > > & rule : grammar.getRules ( ) ) {
-			for ( const ext::variant < ext::vector < SymbolType >, ext::tuple < ext::vector < SymbolType >, SymbolType, ext::vector < SymbolType > > > & rhsTmp : rule.second )
-				if ( rhsTmp.template is < ext::vector < SymbolType > > ( ) ) {
-					const ext::vector < SymbolType > & rhs = rhsTmp.template get < ext::vector < SymbolType > > ( );
+	static bool used ( const grammar::LG < TerminalSymbolType, NonterminalSymbolType > & grammar, const TerminalSymbolType & symbol ) {
+		for ( const std::pair < const NonterminalSymbolType, ext::set < ext::variant < ext::vector < TerminalSymbolType >, ext::tuple < ext::vector < TerminalSymbolType >, NonterminalSymbolType, ext::vector < TerminalSymbolType > > > > > & rule : grammar.getRules ( ) ) {
+			for ( const ext::variant < ext::vector < TerminalSymbolType >, ext::tuple < ext::vector < TerminalSymbolType >, NonterminalSymbolType, ext::vector < TerminalSymbolType > > > & rhsTmp : rule.second )
+				if ( rhsTmp.template is < ext::vector < TerminalSymbolType > > ( ) ) {
+					const ext::vector < TerminalSymbolType > & rhs = rhsTmp.template get < ext::vector < TerminalSymbolType > > ( );
 
 					if ( std::find ( rhs.begin ( ), rhs.end ( ), symbol ) != rhs.end ( ) )
 						return true;
 				} else {
-					const ext::tuple < ext::vector < SymbolType >, SymbolType, ext::vector < SymbolType > > & rhs = rhsTmp.template get < ext::tuple < ext::vector < SymbolType >, SymbolType, ext::vector < SymbolType > > > ( );
+					const ext::tuple < ext::vector < TerminalSymbolType >, NonterminalSymbolType, ext::vector < TerminalSymbolType > > & rhs = rhsTmp.template get < ext::tuple < ext::vector < TerminalSymbolType >, NonterminalSymbolType, ext::vector < TerminalSymbolType > > > ( );
 
-					const ext::vector < SymbolType > & lPart = std::get < 0 > ( rhs );
+					const ext::vector < TerminalSymbolType > & lPart = std::get < 0 > ( rhs );
 
 					if ( std::find ( lPart.begin ( ), lPart.end ( ), symbol ) != lPart.end ( ) )
 						return true;
 
-					const ext::vector < SymbolType > & rPart = std::get < 2 > ( rhs );
+					const ext::vector < TerminalSymbolType > & rPart = std::get < 2 > ( rhs );
 
 					if ( std::find ( rPart.begin ( ), rPart.end ( ), symbol ) != rPart.end ( ) )
 						return true;
@@ -534,7 +536,7 @@ public:
 	 *
 	 * \returns true
 	 */
-	static bool available ( const grammar::LG < SymbolType > &, const SymbolType & ) {
+	static bool available ( const grammar::LG < TerminalSymbolType, NonterminalSymbolType > &, const TerminalSymbolType & ) {
 		return true;
 	}
 
@@ -546,7 +548,7 @@ public:
 	 *
 	 * \throws grammar::GrammarException of the tested symbol is in nonterminal alphabet
 	 */
-	static void valid ( const grammar::LG < SymbolType > & grammar, const SymbolType & symbol ) {
+	static void valid ( const grammar::LG < TerminalSymbolType, NonterminalSymbolType > & grammar, const TerminalSymbolType & symbol ) {
 		if ( grammar.template accessComponent < grammar::NonterminalAlphabet > ( ).get ( ).count ( symbol ) )
 			throw grammar::GrammarException ( "Symbol " + ext::to_string ( symbol ) + "cannot be in terminal alphabet since it is already nonterminal alphabet" );
 	}
@@ -555,10 +557,11 @@ public:
 /**
  * Helper class specifying constraints for the grammar's internal nonterminal alphabet component.
  *
- * \tparam SymbolType used for the nonterminal alphabet of the grammar.
+ * \tparam TerminalSymbolType used for the terminal alphabet of the grammar.
+ * \tparam NonterminalSymbolType used for the nonterminal alphabet, and the initial symbol of the grammar.
  */
-template < class SymbolType >
-class SetConstraint< grammar::LG < SymbolType >, SymbolType, grammar::NonterminalAlphabet > {
+template < class TerminalSymbolType, class NonterminalSymbolType >
+class SetConstraint< grammar::LG < TerminalSymbolType, NonterminalSymbolType >, NonterminalSymbolType, grammar::NonterminalAlphabet > {
 public:
 	/**
 	 * Returns true if the nonterminal symbol is still used in some rule of the grammar or if it is the initial symbol of the grammar.
@@ -568,14 +571,14 @@ public:
 	 *
 	 * \returns true if the symbol is used, false othervise
 	 */
-	static bool used ( const grammar::LG < SymbolType > & grammar, const SymbolType & symbol ) {
-		for ( const std::pair < const SymbolType, ext::set < ext::variant < ext::vector < SymbolType >, ext::tuple < ext::vector < SymbolType >, SymbolType, ext::vector < SymbolType > > > > > & rule : grammar.getRules ( ) ) {
+	static bool used ( const grammar::LG < TerminalSymbolType, NonterminalSymbolType > & grammar, const NonterminalSymbolType & symbol ) {
+		for ( const std::pair < const NonterminalSymbolType, ext::set < ext::variant < ext::vector < TerminalSymbolType >, ext::tuple < ext::vector < TerminalSymbolType >, NonterminalSymbolType, ext::vector < TerminalSymbolType > > > > > & rule : grammar.getRules ( ) ) {
 			if ( rule.first == symbol )
 				return true;
 
-			for ( const ext::variant < ext::vector < SymbolType >, ext::tuple < ext::vector < SymbolType >, SymbolType, ext::vector < SymbolType > > > & rhsTmp : rule.second )
-				if ( rhsTmp.template is < ext::tuple < ext::vector < SymbolType >, SymbolType, ext::vector < SymbolType > > > ( ) ) {
-					const ext::tuple < ext::vector < SymbolType >, SymbolType, ext::vector < SymbolType > > & rhs = rhsTmp.template get < ext::tuple < ext::vector < SymbolType >, SymbolType, ext::vector < SymbolType > > > ( );
+			for ( const ext::variant < ext::vector < TerminalSymbolType >, ext::tuple < ext::vector < TerminalSymbolType >, NonterminalSymbolType, ext::vector < TerminalSymbolType > > > & rhsTmp : rule.second )
+				if ( rhsTmp.template is < ext::tuple < ext::vector < TerminalSymbolType >, NonterminalSymbolType, ext::vector < TerminalSymbolType > > > ( ) ) {
+					const ext::tuple < ext::vector < TerminalSymbolType >, NonterminalSymbolType, ext::vector < TerminalSymbolType > > & rhs = rhsTmp.template get < ext::tuple < ext::vector < TerminalSymbolType >, NonterminalSymbolType, ext::vector < TerminalSymbolType > > > ( );
 
 					if ( std::get < 1 > ( rhs ) == symbol )
 						return true;
@@ -597,7 +600,7 @@ public:
 	 *
 	 * \returns true
 	 */
-	static bool available ( const grammar::LG < SymbolType > &, const SymbolType & ) {
+	static bool available ( const grammar::LG < TerminalSymbolType, NonterminalSymbolType > &, const NonterminalSymbolType & ) {
 		return true;
 	}
 
@@ -609,7 +612,7 @@ public:
 	 *
 	 * \throws grammar::GrammarException of the tested symbol is in nonterminal alphabet
 	 */
-	static void valid ( const grammar::LG < SymbolType > & grammar, const SymbolType & symbol ) {
+	static void valid ( const grammar::LG < TerminalSymbolType, NonterminalSymbolType > & grammar, const NonterminalSymbolType & symbol ) {
 		if ( grammar.template accessComponent < grammar::TerminalAlphabet > ( ).get ( ).count ( symbol ) )
 			throw grammar::GrammarException ( "Symbol " + ext::to_string ( symbol ) + "cannot be in nonterminal alphabet since it is already in terminal alphabet" );
 	}
@@ -618,10 +621,11 @@ public:
 /**
  * Helper class specifying constraints for the grammar's internal initial symbol element.
  *
- * \tparam SymbolType used for the initial symbol of the grammar.
+ * \tparam TerminalSymbolType used for the terminal alphabet of the grammar.
+ * \tparam NonterminalSymbolType used for the nonterminal alphabet, and the initial symbol of the grammar.
  */
-template < class SymbolType >
-class ElementConstraint< grammar::LG < SymbolType >, SymbolType, grammar::InitialSymbol > {
+template < class TerminalSymbolType, class NonterminalSymbolType >
+class ElementConstraint< grammar::LG < TerminalSymbolType, NonterminalSymbolType >, NonterminalSymbolType, grammar::InitialSymbol > {
 public:
 	/**
 	 * Returns true if the symbol requested to be initial is available in nonterminal alphabet.
@@ -631,7 +635,7 @@ public:
 	 *
 	 * \returns true if the tested symbol is in nonterminal alphabet
 	 */
-	static bool available ( const grammar::LG < SymbolType > & grammar, const SymbolType & symbol ) {
+	static bool available ( const grammar::LG < TerminalSymbolType, NonterminalSymbolType > & grammar, const NonterminalSymbolType & symbol ) {
 		return grammar.template accessComponent < grammar::NonterminalAlphabet > ( ).get ( ).count ( symbol );
 	}
 
@@ -641,7 +645,7 @@ public:
 	 * \param grammar the tested grammar
 	 * \param symbol the tested symbol
 	 */
-	static void valid ( const grammar::LG < SymbolType > &, const SymbolType & ) {
+	static void valid ( const grammar::LG < TerminalSymbolType, NonterminalSymbolType > &, const NonterminalSymbolType & ) {
 	}
 };
 
@@ -650,19 +654,19 @@ public:
  *
  * \returns new instance of the grammar with default template parameters or unmodified instance if the template parameters were already default ones
  */
-template < class SymbolType >
-struct normalize < grammar::LG < SymbolType > > {
-	static grammar::LG < > eval ( grammar::LG < SymbolType > && value ) {
+template < class TerminalSymbolType, class NonterminalSymbolType >
+struct normalize < grammar::LG < TerminalSymbolType, NonterminalSymbolType > > {
+	static grammar::LG < > eval ( grammar::LG < TerminalSymbolType, NonterminalSymbolType > && value ) {
 		ext::set < DefaultSymbolType > nonterminals = alphabet::SymbolNormalize::normalizeAlphabet ( std::move ( value ).getNonterminalAlphabet ( ) );
 		ext::set < DefaultSymbolType > terminals = alphabet::SymbolNormalize::normalizeAlphabet ( std::move ( value ).getTerminalAlphabet ( ) );
 		DefaultSymbolType initialSymbol = alphabet::SymbolNormalize::normalizeSymbol ( std::move ( value ).getInitialSymbol ( ) );
 
 		grammar::LG < > res ( std::move ( nonterminals ), std::move ( terminals ), std::move ( initialSymbol ) );
 
-		for ( std::pair < SymbolType, ext::set < ext::variant < ext::vector < SymbolType >, ext::tuple < ext::vector < SymbolType >, SymbolType, ext::vector < SymbolType > > > > > && rule : ext::make_mover ( std::move ( value ).getRules ( ) ) ) {
+		for ( std::pair < NonterminalSymbolType, ext::set < ext::variant < ext::vector < TerminalSymbolType >, ext::tuple < ext::vector < TerminalSymbolType >, NonterminalSymbolType, ext::vector < TerminalSymbolType > > > > > && rule : ext::make_mover ( std::move ( value ).getRules ( ) ) ) {
 
 			ext::set < ext::variant < ext::vector < DefaultSymbolType >, ext::tuple < ext::vector < DefaultSymbolType >, DefaultSymbolType, ext::vector < DefaultSymbolType > > > > rhs;
-			for ( ext::variant < ext::vector < SymbolType >, ext::tuple < ext::vector < SymbolType >, SymbolType, ext::vector < SymbolType > > > && target : ext::make_mover ( rule.second ) )
+			for ( ext::variant < ext::vector < TerminalSymbolType >, ext::tuple < ext::vector < TerminalSymbolType >, NonterminalSymbolType, ext::vector < TerminalSymbolType > > > && target : ext::make_mover ( rule.second ) )
 				rhs.insert ( grammar::GrammarNormalize::normalizeRHS ( std::move ( target ) ) );
 
 			DefaultSymbolType lhs = alphabet::SymbolNormalize::normalizeSymbol ( std::move ( rule.first ) );
diff --git a/alib2data/src/grammar/RawRules.h b/alib2data/src/grammar/RawRules.h
index 8b85944c2918969ee3674b9bec2474736c5d8f48..170f868bca9b7db6bd42a5c7b98226bea2e7c2fe 100644
--- a/alib2data/src/grammar/RawRules.h
+++ b/alib2data/src/grammar/RawRules.h
@@ -32,14 +32,15 @@ public:
 	/**
 	 * Get rules in most common format of rules as mapping from leftHandSide to rightHandSides represented as vectors of symbols.
 	 *
-	 * \tparam SymbolType the type of symbols in the grammar
+	 * \tparam TerminalSymbolType the type of terminal symbols in the grammar
+	 * \tparam NonterminalSymbolType the type of nontermnal symbols in the grammar
 	 *
 	 * \param grammar the source grammar of rules to transform
 	 *
 	 * \returns rules of the grammar in a common representation
 	 */
-	template < class SymbolType, class TerminalSymbolType = SymbolType, class NonterminalSymbolType = SymbolType >
-	static ext::map < NonterminalSymbolType, ext::set < ext::vector < ext::variant < TerminalSymbolType, NonterminalSymbolType > > > > getRawRules ( const LG < SymbolType > & grammar );
+	template < class TerminalSymbolType, class NonterminalSymbolType >
+	static ext::map < NonterminalSymbolType, ext::set < ext::vector < ext::variant < TerminalSymbolType, NonterminalSymbolType > > > > getRawRules ( const LG < TerminalSymbolType, NonterminalSymbolType > & grammar );
 
 	/**
 	 * \override
@@ -90,8 +91,8 @@ public:
 	static ext::map < NonterminalSymbolType, ext::set < ext::vector < ext::variant < TerminalSymbolType, NonterminalSymbolType > > > > getRawRules ( const RightRG < TerminalSymbolType, NonterminalSymbolType > & grammar );
 };
 
-template < class SymbolType, class TerminalSymbolType, class NonterminalSymbolType >
-ext::map < NonterminalSymbolType, ext::set < ext::vector < ext::variant < TerminalSymbolType, NonterminalSymbolType > > > > RawRules::getRawRules ( const LG < SymbolType > & grammar ) {
+template < class TerminalSymbolType, class NonterminalSymbolType >
+ext::map < NonterminalSymbolType, ext::set < ext::vector < ext::variant < TerminalSymbolType, NonterminalSymbolType > > > > RawRules::getRawRules ( const LG < TerminalSymbolType, NonterminalSymbolType > & grammar ) {
 	ext::map < NonterminalSymbolType, ext::set < ext::vector < ext::variant < TerminalSymbolType, NonterminalSymbolType > > > > res;
 
 	for ( const auto & rule : grammar.getRules ( ) )
diff --git a/alib2data/src/grammar/xml/ContextFree/LG.h b/alib2data/src/grammar/xml/ContextFree/LG.h
index f7be1babaa9d7c37fe461f28b7671a32d574a886..e100d85005666acda605017a579e57dd13b88d48 100644
--- a/alib2data/src/grammar/xml/ContextFree/LG.h
+++ b/alib2data/src/grammar/xml/ContextFree/LG.h
@@ -33,8 +33,8 @@
 
 namespace core {
 
-template < class SymbolType >
-struct xmlApi < grammar::LG < SymbolType > > {
+template < class TerminalSymbolType, class NonterminalSymbolType >
+struct xmlApi < grammar::LG < TerminalSymbolType, NonterminalSymbolType > > {
 	/**
 	 * \brief The XML tag name of class.
 	 *
@@ -66,7 +66,7 @@ struct xmlApi < grammar::LG < SymbolType > > {
 	 *
 	 * \returns the new instance of the grammar
 	 */
-	static grammar::LG < SymbolType > parse ( ext::deque < sax::Token >::iterator & input );
+	static grammar::LG < TerminalSymbolType, NonterminalSymbolType > parse ( ext::deque < sax::Token >::iterator & input );
 
 	/**
 	 * Helper for parsing of individual rules of the grammar from a sequence of xml tokens.
@@ -74,7 +74,7 @@ struct xmlApi < grammar::LG < SymbolType > > {
 	 * \params input the iterator to sequence of xml tokens to parse from
 	 * \params grammar the grammar to add the rule to
 	 */
-	static void parseRule ( ext::deque < sax::Token >::iterator & input, grammar::LG < SymbolType > & grammar );
+	static void parseRule ( ext::deque < sax::Token >::iterator & input, grammar::LG < TerminalSymbolType, NonterminalSymbolType > & grammar );
 
 	/**
 	 * Composing to a sequence of xml tokens helper.
@@ -82,7 +82,7 @@ struct xmlApi < grammar::LG < SymbolType > > {
 	 * \param out sink for new xml tokens representing the grammar
 	 * \param grammar the grammar to compose
 	 */
-	static void compose ( ext::deque < sax::Token > & out, const grammar::LG < SymbolType > & grammar );
+	static void compose ( ext::deque < sax::Token > & out, const grammar::LG < TerminalSymbolType, NonterminalSymbolType > & grammar );
 
 	/**
 	 * Helper for composing rules of the grammar to a sequence of xml tokens.
@@ -90,18 +90,18 @@ struct xmlApi < grammar::LG < SymbolType > > {
 	 * \param out sink for xml tokens representing the rules of the grammar
 	 * \param grammar the grammar to compose
 	 */
-	static void composeRules ( ext::deque < sax::Token > & out, const grammar::LG < SymbolType > & grammar );
+	static void composeRules ( ext::deque < sax::Token > & out, const grammar::LG < TerminalSymbolType, NonterminalSymbolType > & grammar );
 };
 
-template < class SymbolType >
-grammar::LG < SymbolType > xmlApi < grammar::LG < SymbolType > >::parse ( ext::deque < sax::Token >::iterator & input ) {
+template < class TerminalSymbolType, class NonterminalSymbolType >
+grammar::LG < TerminalSymbolType, NonterminalSymbolType > xmlApi < grammar::LG < TerminalSymbolType, NonterminalSymbolType > >::parse ( ext::deque < sax::Token >::iterator & input ) {
 	sax::FromXMLParserHelper::popToken ( input, sax::Token::TokenType::START_ELEMENT, xmlTagName ( ) );
 
-	ext::set < SymbolType > nonterminalAlphabet = grammar::GrammarFromXMLParser::parseNonterminalAlphabet < SymbolType > ( input );
-	ext::set < SymbolType > terminalAlphabet = grammar::GrammarFromXMLParser::parseTerminalAlphabet < SymbolType > ( input );
-	SymbolType initialSymbol = grammar::GrammarFromXMLParser::parseInitialSymbol < SymbolType > ( input );
+	ext::set < NonterminalSymbolType > nonterminalAlphabet = grammar::GrammarFromXMLParser::parseNonterminalAlphabet < NonterminalSymbolType > ( input );
+	ext::set < TerminalSymbolType > terminalAlphabet = grammar::GrammarFromXMLParser::parseTerminalAlphabet < TerminalSymbolType > ( input );
+	NonterminalSymbolType initialSymbol = grammar::GrammarFromXMLParser::parseInitialSymbol < NonterminalSymbolType > ( input );
 
-	grammar::LG < SymbolType > grammar ( std::move ( initialSymbol ) );
+	grammar::LG < TerminalSymbolType, NonterminalSymbolType > grammar ( std::move ( initialSymbol ) );
 
 	grammar.setNonterminalAlphabet ( std::move ( nonterminalAlphabet ) );
 	grammar.setTerminalAlphabet ( std::move ( terminalAlphabet ) );
@@ -112,16 +112,16 @@ grammar::LG < SymbolType > xmlApi < grammar::LG < SymbolType > >::parse ( ext::d
 	return grammar;
 }
 
-template < class SymbolType >
-void xmlApi < grammar::LG < SymbolType > >::parseRule ( ext::deque < sax::Token >::iterator & input, grammar::LG < SymbolType > & grammar ) {
-	SymbolType lhs = grammar::GrammarFromXMLParser::parseRuleSingleSymbolLHS < SymbolType > ( input );
-	ext::vector < ext::variant < SymbolType, SymbolType > > rhs = grammar::GrammarFromXMLParser::parseRuleRHS < ext::variant < SymbolType, SymbolType > > ( input );
+template < class TerminalSymbolType, class NonterminalSymbolType >
+void xmlApi < grammar::LG < TerminalSymbolType, NonterminalSymbolType > >::parseRule ( ext::deque < sax::Token >::iterator & input, grammar::LG < TerminalSymbolType, NonterminalSymbolType > & grammar ) {
+	NonterminalSymbolType lhs = grammar::GrammarFromXMLParser::parseRuleSingleSymbolLHS < NonterminalSymbolType > ( input );
+	ext::vector < ext::variant < TerminalSymbolType, NonterminalSymbolType > > rhs = grammar::GrammarFromXMLParser::parseRuleRHS < ext::variant < TerminalSymbolType, NonterminalSymbolType > > ( input );
 
 	grammar::AddRawRule::addRawRule ( grammar, std::move ( lhs ), std::move ( rhs ) );
 }
 
-template < class SymbolType >
-void xmlApi < grammar::LG < SymbolType > >::compose ( ext::deque < sax::Token > & out, const grammar::LG < SymbolType > & grammar ) {
+template < class TerminalSymbolType, class NonterminalSymbolType >
+void xmlApi < grammar::LG < TerminalSymbolType, NonterminalSymbolType > >::compose ( ext::deque < sax::Token > & out, const grammar::LG < TerminalSymbolType, NonterminalSymbolType > & grammar ) {
 	out.emplace_back ( xmlTagName ( ), sax::Token::TokenType::START_ELEMENT );
 
 	grammar::GrammarToXMLComposer::composeNonterminalAlphabet ( out, grammar.getNonterminalAlphabet ( ) );
@@ -132,8 +132,8 @@ void xmlApi < grammar::LG < SymbolType > >::compose ( ext::deque < sax::Token >
 	out.emplace_back ( xmlTagName ( ), sax::Token::TokenType::END_ELEMENT );
 }
 
-template < class SymbolType >
-void xmlApi < grammar::LG < SymbolType > >::composeRules ( ext::deque < sax::Token > & out, const grammar::LG < SymbolType > & grammar ) {
+template < class TerminalSymbolType, class NonterminalSymbolType >
+void xmlApi < grammar::LG < TerminalSymbolType, NonterminalSymbolType > >::composeRules ( ext::deque < sax::Token > & out, const grammar::LG < TerminalSymbolType, NonterminalSymbolType > & grammar ) {
 	out.emplace_back ( "rules", sax::Token::TokenType::START_ELEMENT );
 
 	for ( const auto & rule : grammar.getRules ( ) )
diff --git a/alib2data/test-src/grammar/GrammarTest.cpp b/alib2data/test-src/grammar/GrammarTest.cpp
index e3d0563a06aad36142d63e49c5ef3dd99f47f4d8..daac785bb23f88fae4bd8217d0d7896a55f9dc24 100644
--- a/alib2data/test-src/grammar/GrammarTest.cpp
+++ b/alib2data/test-src/grammar/GrammarTest.cpp
@@ -155,18 +155,18 @@ void GrammarTest::testRegularParser() {
 
 void GrammarTest::testContextFreeParser() {
 	{
-		grammar::LG < > grammar(DefaultSymbolType(1));
+		grammar::LG < std::string, int > grammar ( 1 );
 
-		grammar.addNonterminalSymbol(DefaultSymbolType(1));
-		grammar.addNonterminalSymbol(DefaultSymbolType(2));
-		grammar.addNonterminalSymbol(DefaultSymbolType(3));
-		grammar.addTerminalSymbol(DefaultSymbolType("a"));
-		grammar.addTerminalSymbol(DefaultSymbolType("b"));
+		grammar.addNonterminalSymbol ( 1 );
+		grammar.addNonterminalSymbol ( 2 );
+		grammar.addNonterminalSymbol ( 3 );
+		grammar.addTerminalSymbol ( "a" );
+		grammar.addTerminalSymbol ( "b" );
 
-		grammar.addRule(DefaultSymbolType(1), ext::make_tuple(ext::vector<DefaultSymbolType> {DefaultSymbolType("a")}, DefaultSymbolType(2), ext::vector<DefaultSymbolType>{}));
-		grammar.addRule(DefaultSymbolType(2), ext::make_tuple(ext::vector<DefaultSymbolType> {DefaultSymbolType("b")}, DefaultSymbolType(3), ext::vector<DefaultSymbolType>{}));
-		grammar.addRule(DefaultSymbolType(1), ext::make_tuple(ext::vector<DefaultSymbolType> {}, DefaultSymbolType(3), ext::vector<DefaultSymbolType>{}));
-		grammar.addRule(DefaultSymbolType(1), ext::make_tuple(ext::vector<DefaultSymbolType> {DefaultSymbolType("a"), DefaultSymbolType("a"), DefaultSymbolType("a")}, DefaultSymbolType(2), ext::vector<DefaultSymbolType>{}));
+		grammar.addRule ( 1, ext::make_tuple ( ext::vector < std::string > { "a" }, 2, ext::vector < std::string > { } ) );
+		grammar.addRule ( 2, ext::make_tuple ( ext::vector < std::string > { "b" }, 3, ext::vector < std::string > { } ) );
+		grammar.addRule ( 1, ext::make_tuple ( ext::vector < std::string > { }, 3, ext::vector < std::string > { } ) );
+		grammar.addRule ( 1, ext::make_tuple ( ext::vector < std::string > { "a", "a", "a"}, 2, ext::vector < std::string > { } ) );
 
 		CPPUNIT_ASSERT( grammar == grammar );
 		{
@@ -174,7 +174,7 @@ void GrammarTest::testContextFreeParser() {
 			std::string tmp = sax::SaxComposeInterface::composeMemory ( tokens );
 
 			ext::deque<sax::Token> tokens2 = sax::SaxParseInterface::parseMemory ( tmp );
-			grammar::LG < > grammar2 = factory::XmlDataFactory::fromTokens (std::move(tokens2));
+			grammar::LG < std::string, int > grammar2 = factory::XmlDataFactory::fromTokens (std::move(tokens2));
 
 			CPPUNIT_ASSERT( grammar == grammar2 );
 		}