diff --git a/alib2data/src/automaton/AutomatonBase.h b/alib2data/src/automaton/AutomatonBase.h
index 4038de9f78f8acf44ecfbc88cc05bc6d9589232d..48bb33c0697a8b0df09e0723520c2d16eca4c900 100644
--- a/alib2data/src/automaton/AutomatonBase.h
+++ b/alib2data/src/automaton/AutomatonBase.h
@@ -59,6 +59,8 @@ public:
 	friend std::ostream& operator<<(std::ostream& os, const AutomatonBase& automaton);
 
 	virtual void operator>>(std::ostream&) const = 0;
+
+	virtual operator std::string () const = 0;
 };
 
 } /* namespace automaton */
diff --git a/alib2data/src/automaton/FSM/CompactNFA.cpp b/alib2data/src/automaton/FSM/CompactNFA.cpp
index 5e3a22d065249f1bdd5daead68c271ff22f13fed..6671cf8e073a67f7b22815aa9925a0d9331e9ea7 100644
--- a/alib2data/src/automaton/FSM/CompactNFA.cpp
+++ b/alib2data/src/automaton/FSM/CompactNFA.cpp
@@ -11,6 +11,7 @@
 #include "../../string/StringAlphabetGetter.h"
 #include <ostream>
 #include <algorithm>
+#include <sstream>
 
 namespace automaton {
 
@@ -126,4 +127,10 @@ void CompactNFA::operator>>(std::ostream& out) const {
 		<< ")";
 }
 
+CompactNFA::operator std::string () const {
+	std::stringstream ss;
+	ss << *this;
+	return ss.str();
+}
+
 } /* namespace automaton */
diff --git a/alib2data/src/automaton/FSM/CompactNFA.h b/alib2data/src/automaton/FSM/CompactNFA.h
index 3ec1959049fca8c6aac2057c9c5889fcdfe89671..17baf98b81d59d90ab2de64cd319cd6ec2caf01c 100644
--- a/alib2data/src/automaton/FSM/CompactNFA.h
+++ b/alib2data/src/automaton/FSM/CompactNFA.h
@@ -75,6 +75,8 @@ public:
 	virtual bool operator==(const CompactNFA& other) const;
 
 	virtual void operator>>(std::ostream& os) const;
+
+	virtual operator std::string() const;
 };
 
 } /* namespace automaton */
diff --git a/alib2data/src/automaton/FSM/DFA.cpp b/alib2data/src/automaton/FSM/DFA.cpp
index b7e15b791c3e6fc01247e1d8f9cd8cebac42ba06..6ff34348fbb13c631647659788396985511ce3b1 100644
--- a/alib2data/src/automaton/FSM/DFA.cpp
+++ b/alib2data/src/automaton/FSM/DFA.cpp
@@ -10,6 +10,7 @@
 #include "../../std/map.hpp"
 #include "../AutomatonException.h"
 #include <ostream>
+#include <sstream>
 
 namespace automaton {
 
@@ -149,4 +150,10 @@ void DFA::operator>>(std::ostream& out) const {
 		<< ")";
 }
 
+DFA::operator std::string () const {
+	std::stringstream ss;
+	ss << *this;
+	return ss.str();
+}
+
 } /* namespace automaton */
diff --git a/alib2data/src/automaton/FSM/DFA.h b/alib2data/src/automaton/FSM/DFA.h
index ec5a9795394e4d7feffd37b9b348cfcad04edaba..a87fd23d716da154b8578abd25d5acd9209a449c 100644
--- a/alib2data/src/automaton/FSM/DFA.h
+++ b/alib2data/src/automaton/FSM/DFA.h
@@ -85,6 +85,8 @@ public:
 	virtual bool operator==(const DFA& other) const;
 	
 	virtual void operator>>(std::ostream& os) const;
+
+	virtual operator std::string() const;
 };
 
 } /* namespace automaton */
diff --git a/alib2data/src/automaton/FSM/EpsilonNFA.cpp b/alib2data/src/automaton/FSM/EpsilonNFA.cpp
index 79a1268dac9c0a5511ef59fd892001f68d510a22..2558499995c067909702394eb642f9bdffe34fe2 100644
--- a/alib2data/src/automaton/FSM/EpsilonNFA.cpp
+++ b/alib2data/src/automaton/FSM/EpsilonNFA.cpp
@@ -9,6 +9,7 @@
 #include "../../std/map.hpp"
 #include "../AutomatonException.h"
 #include <ostream>
+#include <sstream>
 
 namespace automaton {
 
@@ -249,4 +250,10 @@ void EpsilonNFA::operator>>(std::ostream& out) const {
 		<< ")";
 }
 
+EpsilonNFA::operator std::string () const {
+	std::stringstream ss;
+	ss << *this;
+	return ss.str();
+}
+
 } /* namespace automaton */
diff --git a/alib2data/src/automaton/FSM/EpsilonNFA.h b/alib2data/src/automaton/FSM/EpsilonNFA.h
index cb2fe65b5bbd27210f3d8ded16df193fadaee401..d60f89c74c6874d6b8513a70b42e18904a6ad30f 100644
--- a/alib2data/src/automaton/FSM/EpsilonNFA.h
+++ b/alib2data/src/automaton/FSM/EpsilonNFA.h
@@ -156,6 +156,8 @@ public:
 	virtual bool operator==(const EpsilonNFA& other) const;
 
 	virtual void operator>>(std::ostream& os) const;
+
+	virtual operator std::string() const;
 };
 
 } /* namespace automaton */
diff --git a/alib2data/src/automaton/FSM/ExtendedNFA.cpp b/alib2data/src/automaton/FSM/ExtendedNFA.cpp
index c21145a5d5190eab5740da25d489c030eefc11a8..e376438117cc32f154a703c86a0a7cd40988e7c4 100644
--- a/alib2data/src/automaton/FSM/ExtendedNFA.cpp
+++ b/alib2data/src/automaton/FSM/ExtendedNFA.cpp
@@ -11,6 +11,7 @@
 #include <ostream>
 #include <algorithm>
 #include "../../regexp/RegExpAlphabetGetter.h"
+#include <sstream>
 
 namespace automaton {
 
@@ -126,4 +127,10 @@ void ExtendedNFA::operator>>(std::ostream& out) const {
 		<< ")";
 }
 
+ExtendedNFA::operator std::string () const {
+	std::stringstream ss;
+	ss << *this;
+	return ss.str();
+}
+
 } /* namespace automaton */
diff --git a/alib2data/src/automaton/FSM/ExtendedNFA.h b/alib2data/src/automaton/FSM/ExtendedNFA.h
index d0847d82e24b03567cebbdcdb54d45d76875c3df..c95bb77aa373a40f84c876e3a2df6c8d16fed8c6 100644
--- a/alib2data/src/automaton/FSM/ExtendedNFA.h
+++ b/alib2data/src/automaton/FSM/ExtendedNFA.h
@@ -74,6 +74,8 @@ public:
 	virtual bool operator==(const ExtendedNFA& other) const;
 
 	virtual void operator>>(std::ostream& os) const;
+
+	virtual operator std::string() const;
 };
 
 } /* namespace automaton */
diff --git a/alib2data/src/automaton/FSM/NFA.cpp b/alib2data/src/automaton/FSM/NFA.cpp
index dd1d8f5837553446673f6b08474e92a4f79c93fa..ff79e0b4d80d783816cc44864a8c34c0cc10a068 100644
--- a/alib2data/src/automaton/FSM/NFA.cpp
+++ b/alib2data/src/automaton/FSM/NFA.cpp
@@ -8,6 +8,7 @@
 #include "NFA.h"
 #include "../AutomatonException.h"
 #include <ostream>
+#include <sstream>
 
 namespace automaton {
 
@@ -138,4 +139,10 @@ void NFA::operator>>(std::ostream& out) const {
 		<< ")";
 }
 
+NFA::operator std::string () const {
+	std::stringstream ss;
+	ss << *this;
+	return ss.str();
+}
+
 } /* namespace automaton */
diff --git a/alib2data/src/automaton/FSM/NFA.h b/alib2data/src/automaton/FSM/NFA.h
index e3efb77104e7883db6f3758224dd18e511be5086..8bcfba5c5b23effcd735889299fa975ab4ee232a 100644
--- a/alib2data/src/automaton/FSM/NFA.h
+++ b/alib2data/src/automaton/FSM/NFA.h
@@ -94,6 +94,8 @@ public:
 	virtual bool operator==(const NFA& other) const;
 
 	virtual void operator>>(std::ostream& os) const;
+
+	virtual operator std::string() const;
 };
 
 } /* namespace automaton */
diff --git a/alib2data/src/automaton/PDA/NPDA.cpp b/alib2data/src/automaton/PDA/NPDA.cpp
index 5c498c2b3bf253c6e1f47e6f34711ca898aa672c..6a4809e22a918bd43def5f52dc1bce46d6aaf690 100644
--- a/alib2data/src/automaton/PDA/NPDA.cpp
+++ b/alib2data/src/automaton/PDA/NPDA.cpp
@@ -9,6 +9,7 @@
 #include "../../std/map.hpp"
 #include "../AutomatonException.h"
 #include <algorithm>
+#include <sstream>
 
 namespace automaton {
 
@@ -152,4 +153,10 @@ void NPDA::operator>>(std::ostream& out) const {
 		<< ")";
 }
 
+NPDA::operator std::string () const {
+	std::stringstream ss;
+	ss << *this;
+	return ss.str();
+}
+
 } /* namespace automaton */
diff --git a/alib2data/src/automaton/PDA/NPDA.h b/alib2data/src/automaton/PDA/NPDA.h
index 3cfb2372baab1e5a3bdf3b836bfd82872427c1a7..dc4c65c5f12303f59cc2ef01d776064c3c291bc5 100644
--- a/alib2data/src/automaton/PDA/NPDA.h
+++ b/alib2data/src/automaton/PDA/NPDA.h
@@ -81,6 +81,7 @@ public:
 
 	virtual void operator>>(std::ostream& os) const;
 
+	virtual operator std::string() const;
 };
 
 } /* namespace automaton */
diff --git a/alib2data/src/automaton/PDA/SinglePopNPDA.cpp b/alib2data/src/automaton/PDA/SinglePopNPDA.cpp
index f11d563453bcce7e46de515b89dfcbbac917ba7b..cb7787a39a0d4cd291b24153be560fb363008bb4 100644
--- a/alib2data/src/automaton/PDA/SinglePopNPDA.cpp
+++ b/alib2data/src/automaton/PDA/SinglePopNPDA.cpp
@@ -9,6 +9,7 @@
 #include "../../std/map.hpp"
 #include "../AutomatonException.h"
 #include <algorithm>
+#include <sstream>
 
 namespace automaton {
 
@@ -148,4 +149,10 @@ void SinglePopNPDA::operator>>(std::ostream& out) const {
 		<< ")";
 }
 
+SinglePopNPDA::operator std::string () const {
+	std::stringstream ss;
+	ss << *this;
+	return ss.str();
+}
+
 } /* namespace automaton */
diff --git a/alib2data/src/automaton/PDA/SinglePopNPDA.h b/alib2data/src/automaton/PDA/SinglePopNPDA.h
index 4544d6195e464b7d8b1c879eec68adbaf129ab6c..12767c98da7534fda3c5cd66fcc2088ef6b5ca7e 100644
--- a/alib2data/src/automaton/PDA/SinglePopNPDA.h
+++ b/alib2data/src/automaton/PDA/SinglePopNPDA.h
@@ -81,6 +81,7 @@ public:
 
 	virtual void operator>>(std::ostream& os) const;
 
+	virtual operator std::string() const;
 };
 
 } /* namespace automaton */
diff --git a/alib2data/src/automaton/TM/OneTapeDTM.cpp b/alib2data/src/automaton/TM/OneTapeDTM.cpp
index 2e699ca519903e6e4441f83a91a9efdcf364125d..27fb8467af0a400709d570c4f822a42bfd90a14c 100644
--- a/alib2data/src/automaton/TM/OneTapeDTM.cpp
+++ b/alib2data/src/automaton/TM/OneTapeDTM.cpp
@@ -8,6 +8,7 @@
 #include "OneTapeDTM.h"
 #include "../../std/map.hpp"
 #include "../AutomatonException.h"
+#include <sstream>
 
 namespace automaton {
 
@@ -130,4 +131,10 @@ void OneTapeDTM::operator>>(std::ostream& out) const {
 			<< ")";
 }
 
+OneTapeDTM::operator std::string () const {
+	std::stringstream ss;
+	ss << *this;
+	return ss.str();
+}
+
 } /* namespace automaton */
diff --git a/alib2data/src/automaton/TM/OneTapeDTM.h b/alib2data/src/automaton/TM/OneTapeDTM.h
index 805ad654883a536f1cb6efc4a417c8016865145b..032971955160b450d4898d95a28a54ce4a977d41 100644
--- a/alib2data/src/automaton/TM/OneTapeDTM.h
+++ b/alib2data/src/automaton/TM/OneTapeDTM.h
@@ -78,6 +78,8 @@ public:
 	virtual bool operator==(const OneTapeDTM& other) const;
 
 	virtual void operator>>(std::ostream& os) const;
+
+	virtual operator std::string() const;
 };
 
 } /* namespace automaton */
diff --git a/alib2data/src/automaton/UnknownAutomaton.cpp b/alib2data/src/automaton/UnknownAutomaton.cpp
index b66f57f5d01617fa123be97b247bfa0851d7efb4..19eed6613766260a9854369e372f6c54ed011327 100644
--- a/alib2data/src/automaton/UnknownAutomaton.cpp
+++ b/alib2data/src/automaton/UnknownAutomaton.cpp
@@ -7,6 +7,7 @@
 
 #include "UnknownAutomaton.h"
 #include "../std/set.hpp"
+#include <sstream>
 
 #include "AutomatonException.h"
 
@@ -210,5 +211,11 @@ void UnknownAutomaton::operator>>(std::ostream& out) const {
 		<< ")";
 }
 
+UnknownAutomaton::operator std::string () const {
+	std::stringstream ss;
+	ss << *this;
+	return ss.str();
+}
+
 } /* namespace automaton */
 
diff --git a/alib2data/src/automaton/UnknownAutomaton.h b/alib2data/src/automaton/UnknownAutomaton.h
index 6b7f65fa312460435534d9ccb3cf566cf8e3454e..f8bd8f13752bbb859211f979a6de650920f0a5d8 100644
--- a/alib2data/src/automaton/UnknownAutomaton.h
+++ b/alib2data/src/automaton/UnknownAutomaton.h
@@ -280,6 +280,8 @@ public:
 	virtual bool operator==(const AutomatonBase& other) const;
 
 	virtual void operator>>(std::ostream& os) const;
+
+	virtual operator std::string() const;
 };
 
 } /* namespace automaton */
diff --git a/alib2data/src/grammar/ContextFree/CFG.cpp b/alib2data/src/grammar/ContextFree/CFG.cpp
index 5a49d3dfeb8b18157c3e308450c46114f167f62e..af0ee70557a9453db8f1c2fc1b675fb78653d930 100644
--- a/alib2data/src/grammar/ContextFree/CFG.cpp
+++ b/alib2data/src/grammar/ContextFree/CFG.cpp
@@ -94,4 +94,10 @@ void CFG::operator>>(std::ostream& out) const {
 			<< ")";
 }
 
+CFG::operator std::string () const {
+	std::stringstream ss;
+	ss << *this;
+	return ss.str();
+}
+
 } /* namespace grammar */
diff --git a/alib2data/src/grammar/ContextFree/CFG.h b/alib2data/src/grammar/ContextFree/CFG.h
index 721fee7c46191ff59c68cc27859048cf7fe8aa73..ea6ef6f3d6743788646a7471b283f75033faa8d7 100644
--- a/alib2data/src/grammar/ContextFree/CFG.h
+++ b/alib2data/src/grammar/ContextFree/CFG.h
@@ -11,6 +11,7 @@
 #include "../GrammarBase.h"
 #include <map>
 #include <vector>
+#include <sstream>
 #include "../common/TerminalNonterminalAlphabetInitialSymbol.h"
 
 namespace grammar {
@@ -44,6 +45,8 @@ public:
 	virtual bool operator==(const CFG& other) const;
 
 	virtual void operator>>(std::ostream& os) const;
+
+	virtual operator std::string () const;
 };
 
 } /* namespace grammar */
diff --git a/alib2data/src/grammar/ContextFree/CNF.cpp b/alib2data/src/grammar/ContextFree/CNF.cpp
index 711cc84d54fe0a05469d4ac700ecd2da394e946c..a5b7050dbca00b38f1c1d1e49bf54ed5352ac8cb 100644
--- a/alib2data/src/grammar/ContextFree/CNF.cpp
+++ b/alib2data/src/grammar/ContextFree/CNF.cpp
@@ -137,4 +137,10 @@ void CNF::operator>>(std::ostream& out) const {
 			<< ")";
 }
 
+CNF::operator std::string () const {
+	std::stringstream ss;
+	ss << *this;
+	return ss.str();
+}
+
 } /* namespace grammar */
diff --git a/alib2data/src/grammar/ContextFree/CNF.h b/alib2data/src/grammar/ContextFree/CNF.h
index 9f2317e31cb2bee9f550d46b41661e14416767bb..277c64a3996dfcd01f8c402ebb7ef4a332731b0c 100644
--- a/alib2data/src/grammar/ContextFree/CNF.h
+++ b/alib2data/src/grammar/ContextFree/CNF.h
@@ -11,6 +11,7 @@
 #include "../GrammarBase.h"
 #include <map>
 #include <vector>
+#include <sstream>
 #include "../../std/variant.hpp"
 #include "../common/TerminalNonterminalAlphabetInitialSymbol.h"
 
@@ -53,6 +54,8 @@ public:
 	virtual bool operator==(const CNF& other) const;
 
 	virtual void operator>>(std::ostream& os) const;
+
+	virtual operator std::string () const;
 };
 
 } /* namespace grammar */
diff --git a/alib2data/src/grammar/ContextFree/EpsilonFreeCFG.cpp b/alib2data/src/grammar/ContextFree/EpsilonFreeCFG.cpp
index 9ed84f4ac13c3cc469d250ffc2c3ac00103407f1..b72ab20e606417a0135cdd0f3fabd9b62f62b31d 100644
--- a/alib2data/src/grammar/ContextFree/EpsilonFreeCFG.cpp
+++ b/alib2data/src/grammar/ContextFree/EpsilonFreeCFG.cpp
@@ -110,4 +110,10 @@ void EpsilonFreeCFG::operator>>(std::ostream& out) const {
 			<< ")";
 }
 
+EpsilonFreeCFG::operator std::string () const {
+	std::stringstream ss;
+	ss << *this;
+	return ss.str();
+}
+
 } /* namespace grammar */
diff --git a/alib2data/src/grammar/ContextFree/EpsilonFreeCFG.h b/alib2data/src/grammar/ContextFree/EpsilonFreeCFG.h
index 149d0c65ed7304a0d262513289e712d2d07ee07f..871b0e027e50cfff29eecbfcb06570e8ec629598 100644
--- a/alib2data/src/grammar/ContextFree/EpsilonFreeCFG.h
+++ b/alib2data/src/grammar/ContextFree/EpsilonFreeCFG.h
@@ -11,6 +11,7 @@
 #include "../GrammarBase.h"
 #include <map>
 #include <vector>
+#include <sstream>
 #include "../common/TerminalNonterminalAlphabetInitialSymbol.h"
 
 namespace grammar {
@@ -48,6 +49,8 @@ public:
 	virtual bool operator==(const EpsilonFreeCFG& other) const;
 
 	virtual void operator>>(std::ostream& os) const;
+
+	virtual operator std::string () const;
 };
 
 } /* namespace grammar */
diff --git a/alib2data/src/grammar/ContextFree/GNF.cpp b/alib2data/src/grammar/ContextFree/GNF.cpp
index 4bf533992af372331d1f70e85509676801a66d91..c86c40af01edd557e25f9a277aab1a065d09efde 100644
--- a/alib2data/src/grammar/ContextFree/GNF.cpp
+++ b/alib2data/src/grammar/ContextFree/GNF.cpp
@@ -105,4 +105,10 @@ void GNF::operator>>(std::ostream& out) const {
 			<< ")";
 }
 
+GNF::operator std::string () const {
+	std::stringstream ss;
+	ss << *this;
+	return ss.str();
+}
+
 } /* namespace grammar */
diff --git a/alib2data/src/grammar/ContextFree/GNF.h b/alib2data/src/grammar/ContextFree/GNF.h
index b3341ec7be6ca9e5c4e97d011e6554a3cdaa2792..d56dc66bf7f93ae966d657f8f19476e6aa21df30 100644
--- a/alib2data/src/grammar/ContextFree/GNF.h
+++ b/alib2data/src/grammar/ContextFree/GNF.h
@@ -11,6 +11,7 @@
 #include "../GrammarBase.h"
 #include <map>
 #include <vector>
+#include <sstream>
 #include "../common/TerminalNonterminalAlphabetInitialSymbol.h"
 
 namespace grammar {
@@ -48,6 +49,8 @@ public:
 	virtual bool operator==(const GNF& other) const;
 
 	virtual void operator>>(std::ostream& os) const;
+
+	virtual operator std::string () const;
 };
 
 } /* namespace grammar */
diff --git a/alib2data/src/grammar/ContextFree/LG.cpp b/alib2data/src/grammar/ContextFree/LG.cpp
index 61a5b80b67fc359159b1ecf812b38f84f3d05d65..ac1fd82d8f9e761d0e85ac2548475df1dad98aaf 100644
--- a/alib2data/src/grammar/ContextFree/LG.cpp
+++ b/alib2data/src/grammar/ContextFree/LG.cpp
@@ -165,4 +165,10 @@ void LG::operator>>(std::ostream& out) const {
 			<< ")";
 }
 
+LG::operator std::string () const {
+	std::stringstream ss;
+	ss << *this;
+	return ss.str();
+}
+
 } /* namespace grammar */
diff --git a/alib2data/src/grammar/ContextFree/LG.h b/alib2data/src/grammar/ContextFree/LG.h
index 61fae87f031f49c55589e663df6cab014289bac5..c76c41dc9ab67ceb436f19822884b4b994469378 100644
--- a/alib2data/src/grammar/ContextFree/LG.h
+++ b/alib2data/src/grammar/ContextFree/LG.h
@@ -12,6 +12,7 @@
 #include <map>
 #include <tuple>
 #include <vector>
+#include <sstream>
 #include "../../std/variant.hpp"
 #include "../common/TerminalNonterminalAlphabetInitialSymbol.h"
 
@@ -52,6 +53,8 @@ public:
 	virtual bool operator==(const LG& other) const;
 
 	virtual void operator>>(std::ostream& os) const;
+
+	virtual operator std::string () const;
 };
 
 } /* namespace grammar */
diff --git a/alib2data/src/grammar/ContextSensitive/CSG.cpp b/alib2data/src/grammar/ContextSensitive/CSG.cpp
index 7e0a12b5e0a2b469794422c6fa06c65e1bdff979..a6be7481a8f5c1f84aee95aa2c81dafdded3e48b 100644
--- a/alib2data/src/grammar/ContextSensitive/CSG.cpp
+++ b/alib2data/src/grammar/ContextSensitive/CSG.cpp
@@ -9,6 +9,7 @@
 #include "../../std/map.hpp"
 #include "../GrammarException.h"
 #include <algorithm>
+#include <sstream>
 
 #include "../../alphabet/Symbol.h"
 
@@ -136,4 +137,10 @@ void CSG::operator>>(std::ostream& out) const {
 			<< ")";
 }
 
+CSG::operator std::string () const {
+	std::stringstream ss;
+	ss << *this;
+	return ss.str();
+}
+
 } /* namespace grammar */
diff --git a/alib2data/src/grammar/ContextSensitive/CSG.h b/alib2data/src/grammar/ContextSensitive/CSG.h
index d1384c28ffd699a5660007726f73e32136545dc4..df441b07dbf907c19f16c79060772c18df0d5b01 100644
--- a/alib2data/src/grammar/ContextSensitive/CSG.h
+++ b/alib2data/src/grammar/ContextSensitive/CSG.h
@@ -48,6 +48,8 @@ public:
 	virtual bool operator==(const CSG& other) const;
 
 	virtual void operator>>(std::ostream& os) const;
+
+	virtual operator std::string () const;
 };
 
 } /* namespace grammar */
diff --git a/alib2data/src/grammar/ContextSensitive/NonContractingGrammar.cpp b/alib2data/src/grammar/ContextSensitive/NonContractingGrammar.cpp
index 710964b9d76a30761c176f7ad811524c670fa468..14a365d635b0afd2b325a3cd756d3a38fe49024e 100644
--- a/alib2data/src/grammar/ContextSensitive/NonContractingGrammar.cpp
+++ b/alib2data/src/grammar/ContextSensitive/NonContractingGrammar.cpp
@@ -9,6 +9,7 @@
 #include "../../std/map.hpp"
 #include "../GrammarException.h"
 #include <algorithm>
+#include <sstream>
 
 #include "../../alphabet/Symbol.h"
 
@@ -117,4 +118,10 @@ void NonContractingGrammar::operator>>(std::ostream& out) const {
 			<< ")";
 }
 
+NonContractingGrammar::operator std::string () const {
+	std::stringstream ss;
+	ss << *this;
+	return ss.str();
+}
+
 } /* namespace grammar */
diff --git a/alib2data/src/grammar/ContextSensitive/NonContractingGrammar.h b/alib2data/src/grammar/ContextSensitive/NonContractingGrammar.h
index 9565901647fb5d62303856de7e425e9f369ad4c5..b868f2d362f6f3d5cdce87e6c0f46da93726422b 100644
--- a/alib2data/src/grammar/ContextSensitive/NonContractingGrammar.h
+++ b/alib2data/src/grammar/ContextSensitive/NonContractingGrammar.h
@@ -48,6 +48,8 @@ public:
 	virtual bool operator==(const NonContractingGrammar& other) const;
 
 	virtual void operator>>(std::ostream& os) const;
+
+	virtual operator std::string () const;
 };
 
 } /* namespace grammar */
diff --git a/alib2data/src/grammar/GrammarBase.h b/alib2data/src/grammar/GrammarBase.h
index 4953e8b00494f22ee1fc17d31ee175b3edaba940..a28b9d1ac278c2f349abc45705a5e3bbb0ab1b91 100644
--- a/alib2data/src/grammar/GrammarBase.h
+++ b/alib2data/src/grammar/GrammarBase.h
@@ -58,15 +58,15 @@ public:
 	virtual bool operator==(const EpsilonFreeCFG& other) const;
 
 	virtual bool operator==(const CNF& other) const;
-	
+
 	virtual bool operator==(const GNF& other) const;
-	
+
 	virtual bool operator==(const CSG& other) const;
-	
+
 	virtual bool operator==(const NonContractingGrammar& other) const;
-	
+
 	virtual bool operator==(const UnrestrictedGrammar& other) const;
-	
+
 	virtual bool operator==(const ContextPreservingUnrestrictedGrammar& other) const;
 
 	virtual bool operator==(const GrammarBase& other) const = 0;
@@ -74,6 +74,8 @@ public:
 	friend std::ostream& operator<<(std::ostream& os, const GrammarBase& grammar);
 
 	virtual void operator>>(std::ostream&) const = 0;
+
+	virtual operator std::string () const = 0;
 };
 
 } /* namespace grammar */
diff --git a/alib2data/src/grammar/Regular/LeftLG.cpp b/alib2data/src/grammar/Regular/LeftLG.cpp
index f3ca2543909acbe1d2bc5673a80dbdc780a5b71d..91ba66a9312be8e7b19be65e591c760a58891d8c 100644
--- a/alib2data/src/grammar/Regular/LeftLG.cpp
+++ b/alib2data/src/grammar/Regular/LeftLG.cpp
@@ -9,6 +9,7 @@
 #include "../../std/map.hpp"
 #include "../GrammarException.h"
 #include <algorithm>
+#include <sstream>
 
 #include "../../alphabet/Symbol.h"
 
@@ -153,4 +154,10 @@ void LeftLG::operator>>(std::ostream& out) const {
 			<< ")";
 }
 
+LeftLG::operator std::string () const {
+	std::stringstream ss;
+	ss << *this;
+	return ss.str();
+}
+
 } /* namespace grammar */
diff --git a/alib2data/src/grammar/Regular/LeftLG.h b/alib2data/src/grammar/Regular/LeftLG.h
index b251bb09c2edb9f112aef7f67ac07bea5c55e206..1561c938d5fcd04a992197548d52518187a6a2df 100644
--- a/alib2data/src/grammar/Regular/LeftLG.h
+++ b/alib2data/src/grammar/Regular/LeftLG.h
@@ -51,6 +51,8 @@ public:
 	virtual bool operator==(const LeftLG& other) const;
 
 	virtual void operator>>(std::ostream& os) const;
+
+	virtual operator std::string () const;
 };
 
 } /* namespace grammar */
diff --git a/alib2data/src/grammar/Regular/LeftRG.cpp b/alib2data/src/grammar/Regular/LeftRG.cpp
index 3f652862b5988b2b59407016fda5a936c830a669..6db45d239dd863c09e54aa2557fa8f26305e7b57 100644
--- a/alib2data/src/grammar/Regular/LeftRG.cpp
+++ b/alib2data/src/grammar/Regular/LeftRG.cpp
@@ -9,6 +9,7 @@
 #include "../../std/map.hpp"
 #include "../GrammarException.h"
 #include <algorithm>
+#include <sstream>
 
 #include "../../alphabet/Symbol.h"
 
@@ -133,4 +134,10 @@ void LeftRG::operator>>(std::ostream& out) const {
 			<< ")";
 }
 
+LeftRG::operator std::string () const {
+	std::stringstream ss;
+	ss << *this;
+	return ss.str();
+}
+
 } /* namespace grammar */
diff --git a/alib2data/src/grammar/Regular/LeftRG.h b/alib2data/src/grammar/Regular/LeftRG.h
index 442061f6e364675736dc88f61cfd4fb5226f44ca..734c583b864979f2db118df6e9651f56c703052e 100644
--- a/alib2data/src/grammar/Regular/LeftRG.h
+++ b/alib2data/src/grammar/Regular/LeftRG.h
@@ -68,6 +68,8 @@ public:
 	virtual bool operator==(const LeftRG& other) const;
 
 	virtual void operator>>(std::ostream& os) const;
+
+	virtual operator std::string () const;
 };
 
 } /* namespace grammar */
diff --git a/alib2data/src/grammar/Regular/RightLG.cpp b/alib2data/src/grammar/Regular/RightLG.cpp
index 1ba4a09b658b153c11f003f3ff85ed7b323553d5..58c386295dfe27085c46055e8e314225d03f57a4 100644
--- a/alib2data/src/grammar/Regular/RightLG.cpp
+++ b/alib2data/src/grammar/Regular/RightLG.cpp
@@ -9,6 +9,7 @@
 #include "../../std/map.hpp"
 #include "../GrammarException.h"
 #include <algorithm>
+#include <sstream>
 
 #include "../../alphabet/Symbol.h"
 
@@ -153,4 +154,10 @@ void RightLG::operator>>(std::ostream& out) const {
 			<< ")";
 }
 
+RightLG::operator std::string () const {
+	std::stringstream ss;
+	ss << *this;
+	return ss.str();
+}
+
 } /* namespace grammar */
diff --git a/alib2data/src/grammar/Regular/RightLG.h b/alib2data/src/grammar/Regular/RightLG.h
index 3446bf5774c64cdb92fa3a2468a21ad5a231a153..c807a57bcd761f4ba225b520980e8e00f517cf4e 100644
--- a/alib2data/src/grammar/Regular/RightLG.h
+++ b/alib2data/src/grammar/Regular/RightLG.h
@@ -51,6 +51,8 @@ public:
 	virtual bool operator==(const RightLG& other) const;
 
 	virtual void operator>>(std::ostream& os) const;
+
+	virtual operator std::string () const;
 };
 
 } /* namespace grammar */
diff --git a/alib2data/src/grammar/Regular/RightRG.cpp b/alib2data/src/grammar/Regular/RightRG.cpp
index f5977479e9c0958f721ac630aa26c2ebe7baacd1..344c6a1446e71887229818400f8c16957a49abbe 100644
--- a/alib2data/src/grammar/Regular/RightRG.cpp
+++ b/alib2data/src/grammar/Regular/RightRG.cpp
@@ -9,6 +9,7 @@
 #include "../../std/map.hpp"
 #include "../GrammarException.h"
 #include <algorithm>
+#include <sstream>
 
 #include "../../alphabet/Symbol.h"
 
@@ -133,4 +134,10 @@ void RightRG::operator>>(std::ostream& out) const {
 			<< ")";
 }
 
+RightRG::operator std::string () const {
+	std::stringstream ss;
+	ss << *this;
+	return ss.str();
+}
+
 } /* namespace grammar */
diff --git a/alib2data/src/grammar/Regular/RightRG.h b/alib2data/src/grammar/Regular/RightRG.h
index e70dce3805232d82618659e380c0b0496c275d15..f9d3c5e3e50341ea18553b69eb98dd9acb4badab 100644
--- a/alib2data/src/grammar/Regular/RightRG.h
+++ b/alib2data/src/grammar/Regular/RightRG.h
@@ -68,6 +68,8 @@ public:
 	virtual bool operator==(const RightRG& other) const;
 
 	virtual void operator>>(std::ostream& os) const;
+
+	virtual operator std::string () const;
 };
 
 } /* namespace grammar */
diff --git a/alib2data/src/grammar/UnknownGrammar.cpp b/alib2data/src/grammar/UnknownGrammar.cpp
index fd05065400cffb2a922df6aa0ef1475ee34ef3ee..869cde6aa7bc7f67cc2b8c6734a6cc696f088381 100644
--- a/alib2data/src/grammar/UnknownGrammar.cpp
+++ b/alib2data/src/grammar/UnknownGrammar.cpp
@@ -8,6 +8,7 @@
 #include "UnknownGrammar.h"
 #include "GrammarException.h"
 #include "../std/set.hpp"
+#include <sstream>
 
 namespace grammar {
 
@@ -106,4 +107,10 @@ void UnknownGrammar::operator>>(std::ostream& out) const {
 		<< ")";
 }
 
+UnknownGrammar::operator std::string () const {
+	std::stringstream ss;
+	ss << *this;
+	return ss.str();
+}
+
 } /* namespace grammar */
diff --git a/alib2data/src/grammar/UnknownGrammar.h b/alib2data/src/grammar/UnknownGrammar.h
index 72fa0ff51313b3fbe99b26d4ef3faa1ab36a7eef..0bf2d895108f15b93b1241380cef5beedf80f4fe 100644
--- a/alib2data/src/grammar/UnknownGrammar.h
+++ b/alib2data/src/grammar/UnknownGrammar.h
@@ -65,6 +65,7 @@ public:
 
 	virtual void operator>>(std::ostream& out) const;
 
+	virtual operator std::string () const;
 };
 
 } /* namespace grammar */
diff --git a/alib2data/src/grammar/Unrestricted/ContextPreservingUnrestrictedGrammar.cpp b/alib2data/src/grammar/Unrestricted/ContextPreservingUnrestrictedGrammar.cpp
index 6938804fc1bca18838e18b344e60ca3556a5b25d..2069a6057896894f221fe58a84a5ea7a83f66531 100644
--- a/alib2data/src/grammar/Unrestricted/ContextPreservingUnrestrictedGrammar.cpp
+++ b/alib2data/src/grammar/Unrestricted/ContextPreservingUnrestrictedGrammar.cpp
@@ -9,6 +9,7 @@
 #include "../../std/map.hpp"
 #include "../GrammarException.h"
 #include <algorithm>
+#include <sstream>
 
 #include "../../alphabet/Symbol.h"
 
@@ -121,4 +122,10 @@ void ContextPreservingUnrestrictedGrammar::operator>>(std::ostream& out) const {
 			<< ")";
 }
 
+ContextPreservingUnrestrictedGrammar::operator std::string () const {
+	std::stringstream ss;
+	ss << *this;
+	return ss.str();
+}
+
 } /* namespace grammar */
diff --git a/alib2data/src/grammar/Unrestricted/ContextPreservingUnrestrictedGrammar.h b/alib2data/src/grammar/Unrestricted/ContextPreservingUnrestrictedGrammar.h
index 81784fb841efb8470e8fecde14242f36af5d0943..180bdf5ee0214a6e73ce62a07d1db73b80ba8ba0 100644
--- a/alib2data/src/grammar/Unrestricted/ContextPreservingUnrestrictedGrammar.h
+++ b/alib2data/src/grammar/Unrestricted/ContextPreservingUnrestrictedGrammar.h
@@ -44,6 +44,8 @@ public:
 	virtual bool operator==(const ContextPreservingUnrestrictedGrammar& other) const;
 
 	virtual void operator>>(std::ostream& os) const;
+
+	virtual operator std::string () const;
 };
 
 } /* namespace grammar */
diff --git a/alib2data/src/grammar/Unrestricted/UnrestrictedGrammar.cpp b/alib2data/src/grammar/Unrestricted/UnrestrictedGrammar.cpp
index a03aabbfbb3e27bf7215d201ca0f4470e92bbd43..f6ca0fb904b04761f2b5fcf39fd539cc4ab54675 100644
--- a/alib2data/src/grammar/Unrestricted/UnrestrictedGrammar.cpp
+++ b/alib2data/src/grammar/Unrestricted/UnrestrictedGrammar.cpp
@@ -9,6 +9,7 @@
 #include "../../std/map.hpp"
 #include "../GrammarException.h"
 #include <algorithm>
+#include <sstream>
 
 #include "../../alphabet/Symbol.h"
 
@@ -102,4 +103,10 @@ void UnrestrictedGrammar::operator>>(std::ostream& out) const {
 			<< ")";
 }
 
+UnrestrictedGrammar::operator std::string () const {
+	std::stringstream ss;
+	ss << *this;
+	return ss.str();
+}
+
 } /* namespace grammar */
diff --git a/alib2data/src/grammar/Unrestricted/UnrestrictedGrammar.h b/alib2data/src/grammar/Unrestricted/UnrestrictedGrammar.h
index d161652a27a296e3df6fc660e82a7725b85ebe38..1f37ac9a5ca0be6a450699f917f5329888d6e53f 100644
--- a/alib2data/src/grammar/Unrestricted/UnrestrictedGrammar.h
+++ b/alib2data/src/grammar/Unrestricted/UnrestrictedGrammar.h
@@ -45,6 +45,8 @@ public:
 	virtual bool operator==(const UnrestrictedGrammar& other) const;
 
 	virtual void operator>>(std::ostream& os) const;
+
+	virtual operator std::string () const;
 };
 
 } /* namespace grammar */
diff --git a/alib2data/src/regexp/RegExpBase.cpp b/alib2data/src/regexp/RegExpBase.cpp
index 82cd52b2d782c36c3dcbbd8ec8a6b30f6fe03858..5d6ee1d24d99627477889e60f15a817dbc8362b4 100644
--- a/alib2data/src/regexp/RegExpBase.cpp
+++ b/alib2data/src/regexp/RegExpBase.cpp
@@ -13,6 +13,14 @@ RegExpBase::~RegExpBase() {
 
 }
 
+bool RegExpBase::operator>=(const RegExpBase& other) const {
+	return !(*this < other);
+}
+
+bool RegExpBase::operator<=(const RegExpBase& other) const {
+	return !(*this > other);
+}
+
 bool RegExpBase::operator!=(const RegExpBase& other) const {
 	return !(*this == other);
 }
diff --git a/alib2data/src/regexp/RegExpBase.h b/alib2data/src/regexp/RegExpBase.h
index a18f1f59bef9dcad5c828d2c253fc380088d737b..cf960301871623342cb389f8cb920193cfd1fcf6 100644
--- a/alib2data/src/regexp/RegExpBase.h
+++ b/alib2data/src/regexp/RegExpBase.h
@@ -27,20 +27,26 @@ public:
 
 	virtual ~RegExpBase() noexcept;
 
-	virtual bool operator <(const RegExpBase& other) const = 0;
-	virtual bool operator ==(const RegExpBase& other) const = 0;
-	virtual bool operator >(const RegExpBase& other) const = 0;
+	bool operator>=(const RegExpBase& other) const;
+
+	bool operator<=(const RegExpBase& other) const;
+
 	bool operator !=(const RegExpBase& other) const;
 
+	virtual bool operator==(const RegExpBase& other) const = 0;
 	virtual bool operator==(const FormalRegExp& other) const = 0;
 	virtual bool operator==(const UnboundedRegExp& other) const = 0;
 
+	virtual bool operator<(const RegExpBase& other) const = 0;
 	virtual bool operator<(const FormalRegExp& other) const = 0;
 	virtual bool operator<(const UnboundedRegExp& other) const = 0;
+	virtual bool operator>(const RegExpBase& other) const = 0;
 
 	friend std::ostream& operator<<(std::ostream& os, const RegExpBase& regexp);
 
 	virtual void operator>>(std::ostream&) const = 0;
+
+	virtual operator std::string () const = 0;
 };
 
 } /* namespace regexp */
diff --git a/alib2data/src/regexp/formal/FormalRegExp.cpp b/alib2data/src/regexp/formal/FormalRegExp.cpp
index e1a6319427f6eba4782f82365c5f5e4edc480370..14c2340f570bcb1c8c4869f2c122329d897292a8 100644
--- a/alib2data/src/regexp/formal/FormalRegExp.cpp
+++ b/alib2data/src/regexp/formal/FormalRegExp.cpp
@@ -127,7 +127,7 @@ void FormalRegExp::setAlphabet(const std::set<alphabet::Symbol> & symbols) {
 bool FormalRegExp::removeSymbolFromAlphabet(const alphabet::Symbol & symbol) {
 	if(this->regExp->testSymbol(symbol))
 		throw exception::AlibException("Input symbol \"" + (std::string) symbol + "\" is used.");
-	
+
 	return alphabet.erase(symbol);
 }
 
@@ -180,7 +180,7 @@ bool FormalRegExp::operator >(const RegExpBase& other) const {
 FormalRegExp::operator std::string () const {
 	std::stringstream ss;
 	ss << *this;
-	return ss.str(); 
+	return ss.str();
 }
 
 } /* namespace regexp */
diff --git a/alib2data/src/regexp/formal/FormalRegExp.h b/alib2data/src/regexp/formal/FormalRegExp.h
index 2a2f7082b4baaaad58da3cda3543c82beb282777..0b2be3ade7ea589617ad63491a2eafddc85feabf 100644
--- a/alib2data/src/regexp/formal/FormalRegExp.h
+++ b/alib2data/src/regexp/formal/FormalRegExp.h
@@ -27,14 +27,14 @@ class FormalRegExpElement;
 class FormalRegExp : public std::element<FormalRegExp, RegExpBase> {
 protected:
 	FormalRegExpElement* regExp;
-	
+
 	std::set<alphabet::Symbol> alphabet;
 
 	/**
 	 * @copydoc FormalRegExpElement::clone() const
 	 */
 	virtual RegExpBase* clone() const;
-	
+
 	/**
 	 * @copydoc FormalRegExpElement::plunder() const
 	 */
@@ -61,7 +61,7 @@ public:
 	 * @return Root node of the regular expression tree
 	 */
 	const FormalRegExpElement& getRegExp() const;
-	
+
 	/**
 	 * @return Root node of the regular expression tree
 	 */
@@ -73,19 +73,19 @@ public:
 	 * @param regExp root node to set
 	 */
 	void setRegExp(const FormalRegExpElement& regExp);
-	
+
 	/**
 	 * Sets the root node of the regular expression tree
 	 * @param regExp root node to set
 	 */
 	void setRegExp(FormalRegExpElement&& regExp);
-	
+
 	/**
 	 * Gets alphabet symbols used in RegExp.
 	 * @return set of alphabet symbols used in regexp.
 	 */
 	const std::set<alphabet::Symbol>& getAlphabet() const;
-	
+
 	/**
 	 * Adds symbol to the alphabet available in the regular expression
 	 * @param symbol new symbol added to the alphabet
@@ -97,13 +97,13 @@ public:
 	 * @param symbols new alphabet
 	 */
 	void setAlphabet(const std::set<alphabet::Symbol>& symbols);
-	
+
 	/**
 	 * Removes symbol from the alphabet of symbol available in the regular expression
 	 * @param symbol removed symbol from the alphabet
 	 */
 	bool removeSymbolFromAlphabet(const alphabet::Symbol & symbol);
-	
+
 	/**
 	 * @return true if regexp represents empty language
 	 */
@@ -132,7 +132,6 @@ public:
 	virtual bool operator<(const UnboundedRegExp&) const;
 
 	virtual operator std::string() const;
-
 };
 
 } /* namespace regexp */