diff --git a/alib2str/src/grammar/string/ContextFree/CFG.h b/alib2str/src/grammar/string/ContextFree/CFG.h
index 248c56ccf64a9121b99b10e5cf3c2341b33aa625..9be8e54fe3c9609cfe7dd803f636784e4eda1d43 100644
--- a/alib2str/src/grammar/string/ContextFree/CFG.h
+++ b/alib2str/src/grammar/string/ContextFree/CFG.h
@@ -18,32 +18,32 @@
 
 namespace core {
 
-template<class SymbolType >
-struct stringApi < grammar::CFG < SymbolType > > {
-	static grammar::CFG < SymbolType > parse ( std::istream & input );
+template < class TerminalSymbolType, class NonterminalSymbolType >
+struct stringApi < grammar::CFG < TerminalSymbolType, NonterminalSymbolType > > {
+	static grammar::CFG < TerminalSymbolType, NonterminalSymbolType > parse ( std::istream & input );
 	static bool first ( std::istream & input );
-	static void compose ( std::ostream & output, const grammar::CFG < SymbolType > & grammar );
+	static void compose ( std::ostream & output, const grammar::CFG < TerminalSymbolType, NonterminalSymbolType > & grammar );
 };
 
-template<class SymbolType >
-grammar::CFG < SymbolType > stringApi < grammar::CFG < SymbolType > >::parse ( std::istream & input ) {
+template < class TerminalSymbolType, class NonterminalSymbolType >
+grammar::CFG < TerminalSymbolType, NonterminalSymbolType > stringApi < grammar::CFG < TerminalSymbolType, NonterminalSymbolType > >::parse ( std::istream & input ) {
 	grammar::GrammarFromStringLexer::Token token = grammar::GrammarFromStringLexer::next(input);
 	if(token.type != grammar::GrammarFromStringLexer::TokenType::CFG)
 		throw exception::CommonException("Unrecognised CFG token.");
 
-	return grammar::GrammarFromStringParserCommon::parseCFLikeGrammar < grammar::CFG < SymbolType > > ( input );
+	return grammar::GrammarFromStringParserCommon::parseCFLikeGrammar < grammar::CFG < TerminalSymbolType, NonterminalSymbolType > > ( input );
 }
 
-template<class SymbolType >
-bool stringApi < grammar::CFG < SymbolType > >::first ( std::istream & input ) {
+template < class TerminalSymbolType, class NonterminalSymbolType >
+bool stringApi < grammar::CFG < TerminalSymbolType, NonterminalSymbolType > >::first ( std::istream & input ) {
 	grammar::GrammarFromStringLexer::Token token = grammar::GrammarFromStringLexer::next ( input );
 	bool res = token.type == grammar::GrammarFromStringLexer::TokenType::CFG;
 	grammar::GrammarFromStringLexer::putback ( input, token );
 	return res;
 }
 
-template<class SymbolType >
-void stringApi < grammar::CFG < SymbolType > >::compose ( std::ostream & output, const grammar::CFG < SymbolType > & grammar ) {
+template < class TerminalSymbolType, class NonterminalSymbolType >
+void stringApi < grammar::CFG < TerminalSymbolType, NonterminalSymbolType > >::compose ( std::ostream & output, const grammar::CFG < TerminalSymbolType, NonterminalSymbolType > & grammar ) {
 	output << "CFG";
 	grammar::GrammarToStringComposerCommon::composeCFLikeGrammar ( output, grammar );
 }
diff --git a/alib2str/src/grammar/string/ContextFree/CNF.h b/alib2str/src/grammar/string/ContextFree/CNF.h
index 5558e89ce963af6f08469a23aa1b2cf9a7a0c5af..ff5ed7bb1b5934f2b49f905a81476ccc0a946e5f 100644
--- a/alib2str/src/grammar/string/ContextFree/CNF.h
+++ b/alib2str/src/grammar/string/ContextFree/CNF.h
@@ -16,36 +16,44 @@
 #include <grammar/string/common/GrammarFromStringParserCommon.h>
 #include <grammar/string/common/GrammarToStringComposerCommon.h>
 
+#include <grammar/properties/IsFITDefinition.h>
+#include <grammar/simplify/MakeFITDefinition.h>
+
 namespace core {
 
-template<class SymbolType >
-struct stringApi < grammar::CNF < SymbolType > > {
-	static grammar::CNF < SymbolType > parse ( std::istream & input );
+template < class TerminalSymbolType, class NonterminalSymbolType >
+struct stringApi < grammar::CNF < TerminalSymbolType, NonterminalSymbolType > > {
+	static grammar::CNF < TerminalSymbolType, NonterminalSymbolType > parse ( std::istream & input );
 	static bool first ( std::istream & input );
-	static void compose ( std::ostream & output, const grammar::CNF < SymbolType > & grammar );
+	static void compose ( std::ostream & output, const grammar::CNF < TerminalSymbolType, NonterminalSymbolType > & grammar );
 };
 
-template<class SymbolType >
-grammar::CNF < SymbolType > stringApi < grammar::CNF < SymbolType > >::parse ( std::istream & input ) {
+template < class TerminalSymbolType, class NonterminalSymbolType >
+grammar::CNF < TerminalSymbolType, NonterminalSymbolType > stringApi < grammar::CNF < TerminalSymbolType, NonterminalSymbolType > >::parse ( std::istream & input ) {
 	grammar::GrammarFromStringLexer::Token token = grammar::GrammarFromStringLexer::next(input);
 	if(token.type != grammar::GrammarFromStringLexer::TokenType::CNF)
 		throw exception::CommonException("Unrecognised CNF token.");
 
-	return grammar::GrammarFromStringParserCommon::parseCFLikeGrammar < grammar::CNF < SymbolType > > ( input );
+	grammar::CNF < TerminalSymbolType, NonterminalSymbolType > grammar = grammar::GrammarFromStringParserCommon::parseCFLikeGrammar < grammar::CNF < TerminalSymbolType, NonterminalSymbolType > > ( input );
+
+	if ( ! grammar::properties::IsFITDefinition::isFITDefinition ( grammar ) )
+		throw exception::CommonException("Init on RHS when generate eps");
+
+	return grammar;
 }
 
-template<class SymbolType >
-bool stringApi < grammar::CNF < SymbolType > >::first ( std::istream & input ) {
+template < class TerminalSymbolType, class NonterminalSymbolType >
+bool stringApi < grammar::CNF < TerminalSymbolType, NonterminalSymbolType > >::first ( std::istream & input ) {
 	grammar::GrammarFromStringLexer::Token token = grammar::GrammarFromStringLexer::next ( input );
 	bool res = token.type == grammar::GrammarFromStringLexer::TokenType::CNF;
 	grammar::GrammarFromStringLexer::putback ( input, token );
 	return res;
 }
 
-template<class SymbolType >
-void stringApi < grammar::CNF < SymbolType > >::compose ( std::ostream & output, const grammar::CNF < SymbolType > & grammar ) {
+template < class TerminalSymbolType, class NonterminalSymbolType >
+void stringApi < grammar::CNF < TerminalSymbolType, NonterminalSymbolType > >::compose ( std::ostream & output, const grammar::CNF < TerminalSymbolType, NonterminalSymbolType > & grammar ) {
 	output << "CNF";
-	grammar::GrammarToStringComposerCommon::composeCFLikeGrammar ( output, grammar );
+	grammar::GrammarToStringComposerCommon::composeCFLikeGrammar ( output, grammar::simplify::MakeFITDefinition::makeFITDefinition ( grammar ) );
 }
 
 } /* namespace core */
diff --git a/alib2str/src/grammar/string/ContextFree/EpsilonFreeCFG.h b/alib2str/src/grammar/string/ContextFree/EpsilonFreeCFG.h
index 77b271cffe0a6009d2a6cf776112a51a99cee79f..cddda5b88c7109583aef35b41317f952572c49ec 100644
--- a/alib2str/src/grammar/string/ContextFree/EpsilonFreeCFG.h
+++ b/alib2str/src/grammar/string/ContextFree/EpsilonFreeCFG.h
@@ -16,36 +16,44 @@
 #include <grammar/string/common/GrammarFromStringParserCommon.h>
 #include <grammar/string/common/GrammarToStringComposerCommon.h>
 
+#include <grammar/properties/IsFITDefinition.h>
+#include <grammar/simplify/MakeFITDefinition.h>
+
 namespace core {
 
-template<class SymbolType >
-struct stringApi < grammar::EpsilonFreeCFG < SymbolType > > {
-	static grammar::EpsilonFreeCFG < SymbolType > parse ( std::istream & input );
+template < class TerminalSymbolType, class NonterminalSymbolType >
+struct stringApi < grammar::EpsilonFreeCFG < TerminalSymbolType, NonterminalSymbolType > > {
+	static grammar::EpsilonFreeCFG < TerminalSymbolType, NonterminalSymbolType > parse ( std::istream & input );
 	static bool first ( std::istream & input );
-	static void compose ( std::ostream & output, const grammar::EpsilonFreeCFG < SymbolType > & grammar );
+	static void compose ( std::ostream & output, const grammar::EpsilonFreeCFG < TerminalSymbolType, NonterminalSymbolType > & grammar );
 };
 
-template<class SymbolType >
-grammar::EpsilonFreeCFG < SymbolType > stringApi < grammar::EpsilonFreeCFG < SymbolType > >::parse ( std::istream & input ) {
+template < class TerminalSymbolType, class NonterminalSymbolType >
+grammar::EpsilonFreeCFG < TerminalSymbolType, NonterminalSymbolType > stringApi < grammar::EpsilonFreeCFG < TerminalSymbolType, NonterminalSymbolType > >::parse ( std::istream & input ) {
 	grammar::GrammarFromStringLexer::Token token = grammar::GrammarFromStringLexer::next(input);
 	if(token.type != grammar::GrammarFromStringLexer::TokenType::EPSILON_FREE_CFG)
 		throw exception::CommonException("Unrecognised EpsilonFreeCFG token.");
 
-	return grammar::GrammarFromStringParserCommon::parseCFLikeGrammar < grammar::EpsilonFreeCFG < SymbolType > > ( input );
+	grammar::EpsilonFreeCFG < TerminalSymbolType, NonterminalSymbolType > grammar = grammar::GrammarFromStringParserCommon::parseCFLikeGrammar < grammar::EpsilonFreeCFG < TerminalSymbolType, NonterminalSymbolType > > ( input );
+
+	if ( ! grammar::properties::IsFITDefinition::isFITDefinition ( grammar ) )
+		throw exception::CommonException("Init on RHS when generate eps");
+
+	return grammar;
 }
 
-template<class SymbolType >
-bool stringApi < grammar::EpsilonFreeCFG < SymbolType > >::first ( std::istream & input ) {
+template < class TerminalSymbolType, class NonterminalSymbolType >
+bool stringApi < grammar::EpsilonFreeCFG < TerminalSymbolType, NonterminalSymbolType > >::first ( std::istream & input ) {
 	grammar::GrammarFromStringLexer::Token token = grammar::GrammarFromStringLexer::next ( input );
 	bool res = token.type == grammar::GrammarFromStringLexer::TokenType::EPSILON_FREE_CFG;
 	grammar::GrammarFromStringLexer::putback ( input, token );
 	return res;
 }
 
-template<class SymbolType >
-void stringApi < grammar::EpsilonFreeCFG < SymbolType > >::compose ( std::ostream & output, const grammar::EpsilonFreeCFG < SymbolType > & grammar ) {
+template < class TerminalSymbolType, class NonterminalSymbolType >
+void stringApi < grammar::EpsilonFreeCFG < TerminalSymbolType, NonterminalSymbolType > >::compose ( std::ostream & output, const grammar::EpsilonFreeCFG < TerminalSymbolType, NonterminalSymbolType > & grammar ) {
 	output << "EPSILON_FREE_CFG";
-	grammar::GrammarToStringComposerCommon::composeCFLikeGrammar ( output, grammar );
+	grammar::GrammarToStringComposerCommon::composeCFLikeGrammar ( output, grammar::simplify::MakeFITDefinition::makeFITDefinition ( grammar ) );
 }
 
 } /* namespace core */
diff --git a/alib2str/src/grammar/string/ContextFree/GNF.h b/alib2str/src/grammar/string/ContextFree/GNF.h
index 0edae27f6d7cec228465c7c7cf1125b450277c8f..6d9a883a5ff9e4542caf470fedde2f6882c007fc 100644
--- a/alib2str/src/grammar/string/ContextFree/GNF.h
+++ b/alib2str/src/grammar/string/ContextFree/GNF.h
@@ -16,6 +16,9 @@
 #include <grammar/string/common/GrammarFromStringParserCommon.h>
 #include <grammar/string/common/GrammarToStringComposerCommon.h>
 
+#include <grammar/properties/IsFITDefinition.h>
+#include <grammar/simplify/MakeFITDefinition.h>
+
 namespace core {
 
 template < class TerminalSymbolType, class NonterminalSymbolType >
@@ -31,7 +34,12 @@ grammar::GNF < TerminalSymbolType, NonterminalSymbolType > stringApi < grammar::
 	if(token.type != grammar::GrammarFromStringLexer::TokenType::GNF)
 		throw exception::CommonException("Unrecognised GNF token.");
 
-	return grammar::GrammarFromStringParserCommon::parseCFLikeGrammar < grammar::GNF < TerminalSymbolType, NonterminalSymbolType > > ( input );
+	grammar::GNF < TerminalSymbolType, NonterminalSymbolType > grammar = grammar::GrammarFromStringParserCommon::parseCFLikeGrammar < grammar::GNF < TerminalSymbolType, NonterminalSymbolType > > ( input );
+
+	if ( ! grammar::properties::IsFITDefinition::isFITDefinition ( grammar ) )
+		throw exception::CommonException("Init on RHS when generate eps");
+
+	return grammar;
 }
 
 template < class TerminalSymbolType, class NonterminalSymbolType >
@@ -45,7 +53,7 @@ bool stringApi < grammar::GNF < TerminalSymbolType, NonterminalSymbolType > >::f
 template < class TerminalSymbolType, class NonterminalSymbolType >
 void stringApi < grammar::GNF < TerminalSymbolType, NonterminalSymbolType > >::compose ( std::ostream & output, const grammar::GNF < TerminalSymbolType, NonterminalSymbolType > & grammar ) {
 	output << "GNF";
-	grammar::GrammarToStringComposerCommon::composeCFLikeGrammar ( output, grammar );
+	grammar::GrammarToStringComposerCommon::composeCFLikeGrammar ( output, grammar::simplify::MakeFITDefinition::makeFITDefinition ( grammar ) );
 }
 
 } /* namespace core */
diff --git a/alib2str/src/grammar/string/ContextFree/LG.h b/alib2str/src/grammar/string/ContextFree/LG.h
index dfe2c9cd42efc411bef32afbbd217c65c35f8b32..acd8ab36c7585c9d87b8b40a281521893f95c3b2 100644
--- a/alib2str/src/grammar/string/ContextFree/LG.h
+++ b/alib2str/src/grammar/string/ContextFree/LG.h
@@ -18,32 +18,32 @@
 
 namespace core {
 
-template<class SymbolType >
-struct stringApi < grammar::LG < SymbolType > > {
-	static grammar::LG < SymbolType > parse ( std::istream & input );
+template < class TerminalSymbolType, class NonterminalSymbolType >
+struct stringApi < grammar::LG < TerminalSymbolType, NonterminalSymbolType > > {
+	static grammar::LG < TerminalSymbolType, NonterminalSymbolType > parse ( std::istream & input );
 	static bool first ( std::istream & input );
-	static void compose ( std::ostream & output, const grammar::LG < SymbolType > & grammar );
+	static void compose ( std::ostream & output, const grammar::LG < TerminalSymbolType, NonterminalSymbolType > & grammar );
 };
 
-template<class SymbolType >
-grammar::LG < SymbolType > stringApi < grammar::LG < SymbolType > >::parse ( std::istream & input ) {
+template < class TerminalSymbolType, class NonterminalSymbolType >
+grammar::LG < TerminalSymbolType, NonterminalSymbolType > stringApi < grammar::LG < TerminalSymbolType, NonterminalSymbolType > >::parse ( std::istream & input ) {
 	grammar::GrammarFromStringLexer::Token token = grammar::GrammarFromStringLexer::next(input);
 	if(token.type != grammar::GrammarFromStringLexer::TokenType::LG)
 		throw exception::CommonException("Unrecognised LG token.");
 
-	return grammar::GrammarFromStringParserCommon::parseCFLikeGrammar < grammar::LG < SymbolType > > ( input );
+	return grammar::GrammarFromStringParserCommon::parseCFLikeGrammar < grammar::LG < TerminalSymbolType, NonterminalSymbolType > > ( input );
 }
 
-template<class SymbolType >
-bool stringApi < grammar::LG < SymbolType > >::first ( std::istream & input ) {
+template < class TerminalSymbolType, class NonterminalSymbolType >
+bool stringApi < grammar::LG < TerminalSymbolType, NonterminalSymbolType > >::first ( std::istream & input ) {
 	grammar::GrammarFromStringLexer::Token token = grammar::GrammarFromStringLexer::next ( input );
 	bool res = token.type == grammar::GrammarFromStringLexer::TokenType::LG;
 	grammar::GrammarFromStringLexer::putback ( input, token );
 	return res;
 }
 
-template<class SymbolType >
-void stringApi < grammar::LG < SymbolType > >::compose ( std::ostream & output, const grammar::LG < SymbolType > & grammar ) {
+template < class TerminalSymbolType, class NonterminalSymbolType >
+void stringApi < grammar::LG < TerminalSymbolType, NonterminalSymbolType > >::compose ( std::ostream & output, const grammar::LG < TerminalSymbolType, NonterminalSymbolType > & grammar ) {
 	output << "LG";
 	grammar::GrammarToStringComposerCommon::composeCFLikeGrammar ( output, grammar );
 }
diff --git a/alib2str/src/grammar/string/Regular/LeftLG.h b/alib2str/src/grammar/string/Regular/LeftLG.h
index 564a29e59e68fc323bfa7fee867dbae559e15b7e..7389ca6d9ae4cf0663e636f1c1bd582054705a9e 100644
--- a/alib2str/src/grammar/string/Regular/LeftLG.h
+++ b/alib2str/src/grammar/string/Regular/LeftLG.h
@@ -18,32 +18,32 @@
 
 namespace core {
 
-template<class SymbolType >
-struct stringApi < grammar::LeftLG < SymbolType > > {
-	static grammar::LeftLG < SymbolType > parse ( std::istream & input );
+template < class TerminalSymbolType, class NonterminalSymbolType >
+struct stringApi < grammar::LeftLG < TerminalSymbolType, NonterminalSymbolType > > {
+	static grammar::LeftLG < TerminalSymbolType, NonterminalSymbolType > parse ( std::istream & input );
 	static bool first ( std::istream & input );
-	static void compose ( std::ostream & output, const grammar::LeftLG < SymbolType > & grammar );
+	static void compose ( std::ostream & output, const grammar::LeftLG < TerminalSymbolType, NonterminalSymbolType > & grammar );
 };
 
-template<class SymbolType >
-grammar::LeftLG < SymbolType > stringApi < grammar::LeftLG < SymbolType > >::parse ( std::istream & input ) {
+template < class TerminalSymbolType, class NonterminalSymbolType >
+grammar::LeftLG < TerminalSymbolType, NonterminalSymbolType > stringApi < grammar::LeftLG < TerminalSymbolType, NonterminalSymbolType > >::parse ( std::istream & input ) {
 	grammar::GrammarFromStringLexer::Token token = grammar::GrammarFromStringLexer::next(input);
 	if(token.type != grammar::GrammarFromStringLexer::TokenType::LEFT_LG)
 		throw exception::CommonException("Unrecognised LeftLG token.");
 
-	return grammar::GrammarFromStringParserCommon::parseCFLikeGrammar < grammar::LeftLG < SymbolType > > ( input );
+	return grammar::GrammarFromStringParserCommon::parseCFLikeGrammar < grammar::LeftLG < TerminalSymbolType, NonterminalSymbolType > > ( input );
 }
 
-template<class SymbolType >
-bool stringApi < grammar::LeftLG < SymbolType > >::first ( std::istream & input ) {
+template < class TerminalSymbolType, class NonterminalSymbolType >
+bool stringApi < grammar::LeftLG < TerminalSymbolType, NonterminalSymbolType > >::first ( std::istream & input ) {
 	grammar::GrammarFromStringLexer::Token token = grammar::GrammarFromStringLexer::next ( input );
 	bool res = token.type == grammar::GrammarFromStringLexer::TokenType::LEFT_LG;
 	grammar::GrammarFromStringLexer::putback ( input, token );
 	return res;
 }
 
-template<class SymbolType >
-void stringApi < grammar::LeftLG < SymbolType > >::compose ( std::ostream & output, const grammar::LeftLG < SymbolType > & grammar ) {
+template < class TerminalSymbolType, class NonterminalSymbolType >
+void stringApi < grammar::LeftLG < TerminalSymbolType, NonterminalSymbolType > >::compose ( std::ostream & output, const grammar::LeftLG < TerminalSymbolType, NonterminalSymbolType > & grammar ) {
 	output << "LEFT_LG";
 	grammar::GrammarToStringComposerCommon::composeCFLikeGrammar ( output, grammar );
 }
diff --git a/alib2str/src/grammar/string/Regular/LeftRG.h b/alib2str/src/grammar/string/Regular/LeftRG.h
index 796082ead7dc3ca1ea6043a1e4d0bb4c1053dd6f..d86a65baa713245f1923050caf230d2c0edaac24 100644
--- a/alib2str/src/grammar/string/Regular/LeftRG.h
+++ b/alib2str/src/grammar/string/Regular/LeftRG.h
@@ -21,20 +21,20 @@
 
 namespace core {
 
-template<class SymbolType >
-struct stringApi < grammar::LeftRG < SymbolType > > {
-	static grammar::LeftRG < SymbolType > parse ( std::istream & input );
+template < class TerminalSymbolType, class NonterminalSymbolType >
+struct stringApi < grammar::LeftRG < TerminalSymbolType, NonterminalSymbolType > > {
+	static grammar::LeftRG < TerminalSymbolType, NonterminalSymbolType > parse ( std::istream & input );
 	static bool first ( std::istream & input );
-	static void compose ( std::ostream & output, const grammar::LeftRG < SymbolType > & grammar );
+	static void compose ( std::ostream & output, const grammar::LeftRG < TerminalSymbolType, NonterminalSymbolType > & grammar );
 };
 
-template<class SymbolType >
-grammar::LeftRG < SymbolType > stringApi < grammar::LeftRG < SymbolType > >::parse ( std::istream & input ) {
+template < class TerminalSymbolType, class NonterminalSymbolType >
+grammar::LeftRG < TerminalSymbolType, NonterminalSymbolType > stringApi < grammar::LeftRG < TerminalSymbolType, NonterminalSymbolType > >::parse ( std::istream & input ) {
 	grammar::GrammarFromStringLexer::Token token = grammar::GrammarFromStringLexer::next(input);
 	if(token.type != grammar::GrammarFromStringLexer::TokenType::LEFT_RG)
 		throw exception::CommonException("Unrecognised LeftRG token.");
 
-	grammar::LeftRG < SymbolType > grammar = grammar::GrammarFromStringParserCommon::parseCFLikeGrammar < grammar::LeftRG < SymbolType > > ( input );
+	grammar::LeftRG < TerminalSymbolType, NonterminalSymbolType > grammar = grammar::GrammarFromStringParserCommon::parseCFLikeGrammar < grammar::LeftRG < TerminalSymbolType, NonterminalSymbolType > > ( input );
 
 	if ( ! grammar::properties::IsFITDefinition::isFITDefinition ( grammar ) )
 		throw exception::CommonException("Init on RHS when generate eps");
@@ -42,16 +42,16 @@ grammar::LeftRG < SymbolType > stringApi < grammar::LeftRG < SymbolType > >::par
 	return grammar;
 }
 
-template<class SymbolType >
-bool stringApi < grammar::LeftRG < SymbolType > >::first ( std::istream & input ) {
+template < class TerminalSymbolType, class NonterminalSymbolType >
+bool stringApi < grammar::LeftRG < TerminalSymbolType, NonterminalSymbolType > >::first ( std::istream & input ) {
 	grammar::GrammarFromStringLexer::Token token = grammar::GrammarFromStringLexer::next ( input );
 	bool res = token.type == grammar::GrammarFromStringLexer::TokenType::LEFT_RG;
 	grammar::GrammarFromStringLexer::putback ( input, token );
 	return res;
 }
 
-template<class SymbolType >
-void stringApi < grammar::LeftRG < SymbolType > >::compose ( std::ostream & output, const grammar::LeftRG < SymbolType > & grammar ) {
+template < class TerminalSymbolType, class NonterminalSymbolType >
+void stringApi < grammar::LeftRG < TerminalSymbolType, NonterminalSymbolType > >::compose ( std::ostream & output, const grammar::LeftRG < TerminalSymbolType, NonterminalSymbolType > & grammar ) {
 	output << "LEFT_RG";
 	grammar::GrammarToStringComposerCommon::composeCFLikeGrammar ( output, grammar::simplify::MakeFITDefinition::makeFITDefinition ( grammar ) );
 }
diff --git a/alib2str/src/grammar/string/Regular/RightLG.h b/alib2str/src/grammar/string/Regular/RightLG.h
index 5927778c9be6ea5522505096d94dda5b3c659985..fad9926235a1f8a21224b521ccd7aa0ada0eeb63 100644
--- a/alib2str/src/grammar/string/Regular/RightLG.h
+++ b/alib2str/src/grammar/string/Regular/RightLG.h
@@ -18,32 +18,32 @@
 
 namespace core {
 
-template<class SymbolType >
-struct stringApi < grammar::RightLG < SymbolType > > {
-	static grammar::RightLG < SymbolType > parse ( std::istream & input );
+template < class TerminalSymbolType, class NonterminalSymbolType >
+struct stringApi < grammar::RightLG < TerminalSymbolType, NonterminalSymbolType > > {
+	static grammar::RightLG < TerminalSymbolType, NonterminalSymbolType > parse ( std::istream & input );
 	static bool first ( std::istream & input );
-	static void compose ( std::ostream & output, const grammar::RightLG < SymbolType > & grammar );
+	static void compose ( std::ostream & output, const grammar::RightLG < TerminalSymbolType, NonterminalSymbolType > & grammar );
 };
 
-template<class SymbolType >
-grammar::RightLG < SymbolType > stringApi < grammar::RightLG < SymbolType > >::parse ( std::istream & input ) {
+template < class TerminalSymbolType, class NonterminalSymbolType >
+grammar::RightLG < TerminalSymbolType, NonterminalSymbolType > stringApi < grammar::RightLG < TerminalSymbolType, NonterminalSymbolType > >::parse ( std::istream & input ) {
 	grammar::GrammarFromStringLexer::Token token = grammar::GrammarFromStringLexer::next(input);
 	if(token.type != grammar::GrammarFromStringLexer::TokenType::RIGHT_LG)
 		throw exception::CommonException("Unrecognised RightLG token.");
 
-	return grammar::GrammarFromStringParserCommon::parseCFLikeGrammar < grammar::RightLG < SymbolType > > ( input );
+	return grammar::GrammarFromStringParserCommon::parseCFLikeGrammar < grammar::RightLG < TerminalSymbolType, NonterminalSymbolType > > ( input );
 }
 
-template<class SymbolType >
-bool stringApi < grammar::RightLG < SymbolType > >::first ( std::istream & input ) {
+template < class TerminalSymbolType, class NonterminalSymbolType >
+bool stringApi < grammar::RightLG < TerminalSymbolType, NonterminalSymbolType > >::first ( std::istream & input ) {
 	grammar::GrammarFromStringLexer::Token token = grammar::GrammarFromStringLexer::next ( input );
 	bool res = token.type == grammar::GrammarFromStringLexer::TokenType::RIGHT_LG;
 	grammar::GrammarFromStringLexer::putback ( input, token );
 	return res;
 }
 
-template<class SymbolType >
-void stringApi < grammar::RightLG < SymbolType > >::compose ( std::ostream & output, const grammar::RightLG < SymbolType > & grammar ) {
+template < class TerminalSymbolType, class NonterminalSymbolType >
+void stringApi < grammar::RightLG < TerminalSymbolType, NonterminalSymbolType > >::compose ( std::ostream & output, const grammar::RightLG < TerminalSymbolType, NonterminalSymbolType > & grammar ) {
 	output << "RIGHT_LG";
 	grammar::GrammarToStringComposerCommon::composeCFLikeGrammar ( output, grammar );
 }
diff --git a/alib2str/test-src/grammar/GrammarTest.cpp b/alib2str/test-src/grammar/GrammarTest.cpp
index 29d4f9efb296c299480ca682eea6311dcdf196a1..d546b6ebb3553071cea156627c4097983df475b6 100644
--- a/alib2str/test-src/grammar/GrammarTest.cpp
+++ b/alib2str/test-src/grammar/GrammarTest.cpp
@@ -39,19 +39,21 @@ void GrammarTest::tearDown() {
 void GrammarTest::stringParserTest() {
 	{
 		std::string input1 = 	"CNF (\n"
-					"{A, B, S},\n"
+					"{A, B, R, S},\n"
 					"{a, b},\n"
 					"{ A -> A A | a,\n"
 					"  B -> B B | b,\n"
-					"  S -> | B S | S A},\n"
+					"  R -> B R | R A,\n"
+					"  S -> | B R | R A},\n"
 					"S)\n";
 		grammar::Grammar grammar1 = factory::StringDataFactory::fromString (input1);
 		std::string input2 = 	"CNF (\n"
-					"{A, B, S},\n"
+					"{A, B, R, S},\n"
 					"{a, b},\n"
 					"{ A -> A A | a,\n"
 					"  B -> B B | b,\n"
-					"  S -> #E | B S | S A},\n"
+					"  R -> B R | R A,\n"
+					"  S -> #E | B R | R A},\n"
 					"S)\n";
 		grammar::Grammar grammar2 = factory::StringDataFactory::fromString (input2);