From 6a27c7cfb3d20ea0ee9443f2b16b7d4bd814bdee Mon Sep 17 00:00:00 2001
From: Honza <honza@Pinguino.zoo>
Date: Sun, 8 Dec 2013 13:14:56 +0100
Subject: [PATCH] feature: adiff for automata

---
 adiff/.cproject     | 140 ++++++++++++++++++++++++++++++++++++++++++++
 adiff/.project      |  28 +++++++++
 adiff/src/Diff.cpp  | 131 +++++++++++++++++++++++++++++++++++++++++
 adiff/src/Diff.h    |  27 +++++++++
 adiff/src/adiff.cpp |  43 ++++++++++++++
 5 files changed, 369 insertions(+)
 create mode 100644 adiff/.cproject
 create mode 100644 adiff/.project
 create mode 100644 adiff/src/Diff.cpp
 create mode 100644 adiff/src/Diff.h
 create mode 100644 adiff/src/adiff.cpp

diff --git a/adiff/.cproject b/adiff/.cproject
new file mode 100644
index 0000000000..76c4eeef6a
--- /dev/null
+++ b/adiff/.cproject
@@ -0,0 +1,140 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
+	<storageModule moduleId="org.eclipse.cdt.core.settings">
+		<cconfiguration id="cdt.managedbuild.config.gnu.exe.debug.1389902454">
+			<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.exe.debug.1389902454" moduleId="org.eclipse.cdt.core.settings" name="Debug">
+				<externalSettings/>
+				<extensions>
+					<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+					<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+					<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+					<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+					<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+					<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+				</extensions>
+			</storageModule>
+			<storageModule moduleId="cdtBuildSystem" version="4.0.0">
+				<configuration artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug,org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.exe.debug.1389902454" name="Debug" parent="cdt.managedbuild.config.gnu.exe.debug">
+					<folderInfo id="cdt.managedbuild.config.gnu.exe.debug.1389902454." name="/" resourcePath="">
+						<toolChain id="cdt.managedbuild.toolchain.gnu.exe.debug.454626149" name="Linux GCC" superClass="cdt.managedbuild.toolchain.gnu.exe.debug">
+							<targetPlatform id="cdt.managedbuild.target.gnu.platform.exe.debug.812693871" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.exe.debug"/>
+							<builder buildPath="${workspace_loc:/aconvert}/Debug" id="cdt.managedbuild.target.gnu.builder.exe.debug.2059924356" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="cdt.managedbuild.target.gnu.builder.exe.debug"/>
+							<tool id="cdt.managedbuild.tool.gnu.archiver.base.782713060" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/>
+							<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug.452059746" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug">
+								<option id="gnu.cpp.compiler.exe.debug.option.optimization.level.321734892" name="Optimization Level" superClass="gnu.cpp.compiler.exe.debug.option.optimization.level" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>
+								<option id="gnu.cpp.compiler.exe.debug.option.debugging.level.1415246353" name="Debug Level" superClass="gnu.cpp.compiler.exe.debug.option.debugging.level" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/>
+								<option id="gnu.cpp.compiler.option.include.paths.2073574774" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath">
+									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/alib/src}&quot;"/>
+									<listOptionValue builtIn="false" value="/usr/include/libxml2"/>
+								</option>
+								<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.1656337932" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
+							</tool>
+							<tool id="cdt.managedbuild.tool.gnu.c.compiler.exe.debug.1115594717" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.exe.debug">
+								<option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.exe.debug.option.optimization.level.1539673145" name="Optimization Level" superClass="gnu.c.compiler.exe.debug.option.optimization.level" valueType="enumerated"/>
+								<option id="gnu.c.compiler.exe.debug.option.debugging.level.766263807" name="Debug Level" superClass="gnu.c.compiler.exe.debug.option.debugging.level" value="gnu.c.debugging.level.max" valueType="enumerated"/>
+								<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.2117920585" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
+							</tool>
+							<tool id="cdt.managedbuild.tool.gnu.c.linker.exe.debug.1240065093" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.exe.debug"/>
+							<tool id="cdt.managedbuild.tool.gnu.cpp.linker.exe.debug.1385250618" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.exe.debug">
+								<option id="gnu.cpp.link.option.paths.128536543" name="Library search path (-L)" superClass="gnu.cpp.link.option.paths" valueType="libPaths">
+									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/alib/Debug}&quot;"/>
+								</option>
+								<option id="gnu.cpp.link.option.libs.88373145" name="Libraries (-l)" superClass="gnu.cpp.link.option.libs" valueType="libs">
+									<listOptionValue builtIn="false" srcPrefixMapping="" srcRootPath="" value="alib"/>
+									<listOptionValue builtIn="false" srcPrefixMapping="" srcRootPath="" value="xml2"/>
+								</option>
+								<inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.1779546704" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
+									<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+									<additionalInput kind="additionalinput" paths="$(LIBS)"/>
+								</inputType>
+							</tool>
+							<tool id="cdt.managedbuild.tool.gnu.assembler.exe.debug.295789707" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.exe.debug">
+								<inputType id="cdt.managedbuild.tool.gnu.assembler.input.132473088" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+							</tool>
+						</toolChain>
+					</folderInfo>
+					<sourceEntries>
+						<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src"/>
+					</sourceEntries>
+				</configuration>
+			</storageModule>
+			<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+		</cconfiguration>
+		<cconfiguration id="cdt.managedbuild.config.gnu.exe.release.2111257635">
+			<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.exe.release.2111257635" moduleId="org.eclipse.cdt.core.settings" name="Release">
+				<externalSettings/>
+				<extensions>
+					<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+					<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+					<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+					<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+					<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+					<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+				</extensions>
+			</storageModule>
+			<storageModule moduleId="cdtBuildSystem" version="4.0.0">
+				<configuration artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.release,org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.exe.release.2111257635" name="Release" parent="cdt.managedbuild.config.gnu.exe.release">
+					<folderInfo id="cdt.managedbuild.config.gnu.exe.release.2111257635." name="/" resourcePath="">
+						<toolChain id="cdt.managedbuild.toolchain.gnu.exe.release.827624498" name="Linux GCC" superClass="cdt.managedbuild.toolchain.gnu.exe.release">
+							<targetPlatform id="cdt.managedbuild.target.gnu.platform.exe.release.882598890" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.exe.release"/>
+							<builder buildPath="${workspace_loc:/aconvert}/Release" id="cdt.managedbuild.target.gnu.builder.exe.release.1272738146" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="cdt.managedbuild.target.gnu.builder.exe.release"/>
+							<tool id="cdt.managedbuild.tool.gnu.archiver.base.324375521" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/>
+							<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.exe.release.1207678972" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.exe.release">
+								<option id="gnu.cpp.compiler.exe.release.option.optimization.level.1925326928" name="Optimization Level" superClass="gnu.cpp.compiler.exe.release.option.optimization.level" value="gnu.cpp.compiler.optimization.level.most" valueType="enumerated"/>
+								<option id="gnu.cpp.compiler.exe.release.option.debugging.level.33064772" name="Debug Level" superClass="gnu.cpp.compiler.exe.release.option.debugging.level" value="gnu.cpp.compiler.debugging.level.none" valueType="enumerated"/>
+								<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.764767250" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
+							</tool>
+							<tool id="cdt.managedbuild.tool.gnu.c.compiler.exe.release.1173822661" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.exe.release">
+								<option defaultValue="gnu.c.optimization.level.most" id="gnu.c.compiler.exe.release.option.optimization.level.1245639446" name="Optimization Level" superClass="gnu.c.compiler.exe.release.option.optimization.level" valueType="enumerated"/>
+								<option id="gnu.c.compiler.exe.release.option.debugging.level.548864709" name="Debug Level" superClass="gnu.c.compiler.exe.release.option.debugging.level" value="gnu.c.debugging.level.none" valueType="enumerated"/>
+								<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1359867868" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
+							</tool>
+							<tool id="cdt.managedbuild.tool.gnu.c.linker.exe.release.1157405154" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.exe.release"/>
+							<tool id="cdt.managedbuild.tool.gnu.cpp.linker.exe.release.1898429834" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.exe.release">
+								<inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.174029232" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
+									<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+									<additionalInput kind="additionalinput" paths="$(LIBS)"/>
+								</inputType>
+							</tool>
+							<tool id="cdt.managedbuild.tool.gnu.assembler.exe.release.500953211" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.exe.release">
+								<inputType id="cdt.managedbuild.tool.gnu.assembler.input.1087716091" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+							</tool>
+						</toolChain>
+					</folderInfo>
+					<sourceEntries>
+						<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src"/>
+					</sourceEntries>
+				</configuration>
+			</storageModule>
+			<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+		</cconfiguration>
+	</storageModule>
+	<storageModule moduleId="cdtBuildSystem" version="4.0.0">
+		<project id="aconvert.cdt.managedbuild.target.gnu.exe.1109212462" name="Executable" projectType="cdt.managedbuild.target.gnu.exe"/>
+	</storageModule>
+	<storageModule moduleId="scannerConfiguration">
+		<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+		<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.debug.1389902454;cdt.managedbuild.config.gnu.exe.debug.1389902454.;cdt.managedbuild.tool.gnu.c.compiler.exe.debug.1115594717;cdt.managedbuild.tool.gnu.c.compiler.input.2117920585">
+			<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+		</scannerConfigBuildInfo>
+		<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.release.2111257635;cdt.managedbuild.config.gnu.exe.release.2111257635.;cdt.managedbuild.tool.gnu.c.compiler.exe.release.1173822661;cdt.managedbuild.tool.gnu.c.compiler.input.1359867868">
+			<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+		</scannerConfigBuildInfo>
+		<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.debug.1389902454;cdt.managedbuild.config.gnu.exe.debug.1389902454.;cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug.452059746;cdt.managedbuild.tool.gnu.cpp.compiler.input.1656337932">
+			<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+		</scannerConfigBuildInfo>
+		<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.release.2111257635;cdt.managedbuild.config.gnu.exe.release.2111257635.;cdt.managedbuild.tool.gnu.cpp.compiler.exe.release.1207678972;cdt.managedbuild.tool.gnu.cpp.compiler.input.764767250">
+			<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+		</scannerConfigBuildInfo>
+	</storageModule>
+	<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
+	<storageModule moduleId="refreshScope" versionNumber="2">
+		<configuration configurationName="Release">
+			<resource resourceType="PROJECT" workspacePath="/adiff"/>
+		</configuration>
+		<configuration configurationName="Debug">
+			<resource resourceType="PROJECT" workspacePath="/adiff"/>
+			<resource resourceType="PROJECT" workspacePath="/acat"/>
+		</configuration>
+	</storageModule>
+</cproject>
diff --git a/adiff/.project b/adiff/.project
new file mode 100644
index 0000000000..043bbf299b
--- /dev/null
+++ b/adiff/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>adiff</name>
+	<comment></comment>
+	<projects>
+		<project>alib</project>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
+			<triggers>clean,full,incremental,</triggers>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
+			<triggers>full,incremental,</triggers>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.cdt.core.cnature</nature>
+		<nature>org.eclipse.cdt.core.ccnature</nature>
+		<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
+		<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
+	</natures>
+</projectDescription>
diff --git a/adiff/src/Diff.cpp b/adiff/src/Diff.cpp
new file mode 100644
index 0000000000..b4915bc201
--- /dev/null
+++ b/adiff/src/Diff.cpp
@@ -0,0 +1,131 @@
+/*
+ * DotConverter.cpp
+ *
+ *  Created on: Apr 1, 2013
+ *      Author: martin
+ */
+
+#include "Diff.h"
+#include "automaton/State.h"
+
+#include "automaton/Automaton.h"
+
+#include <set>
+#include <map>
+#include <list>
+#include <utility>
+#include <vector>
+#include <typeinfo>
+#include <iostream>
+#include <algorithm>
+
+using namespace std;
+using namespace automaton;
+
+bool Diff::testDiff(const automaton::UnknownAutomaton& a, const automaton::UnknownAutomaton& b) {
+	return  a.getBlankSymbol()   == b.getBlankSymbol()   &&
+			a.getFinalStates()   == b.getFinalStates()   &&
+			a.getInitialStates() == b.getInitialStates() &&
+			a.getInputAlphabet() == b.getInputAlphabet() &&
+			a.getStackAlphabet() == b.getStackAlphabet() &&
+			a.getStartSymbols()  == b.getStartSymbols()  &&
+			a.getStates()        == b.getStates()        &&
+			a.getTapeAlphabet()  == b.getTapeAlphabet()  &&
+			a.getTransitions()   == b.getTransitions()   ;
+}
+
+template <class T> void Diff::setDiff(const set<T> a, const set<T> b) {
+	set<T> aMinusB;
+	set_difference(a.begin(), a.end(), b.begin(), b.end(), std::inserter(aMinusB, aMinusB.begin()));
+
+	set<T> bMinusA;
+	set_difference(b.begin(), b.end(), a.begin(), a.end(), std::inserter(bMinusA, bMinusA.begin()));
+
+	for(typename set<T>::const_iterator iter = aMinusB.begin(); iter != aMinusB.end(); iter++) {
+		cout << "< " << *iter << endl;
+	}
+	cout << "---" << endl;
+	for(typename set<T>::const_iterator iter = bMinusA.begin(); iter != bMinusA.end(); iter++) {
+		cout << "> " << *iter << endl;
+	}
+}
+
+template <class T> void Diff::listDiff(const list<T> a, const list<T> b) {
+	list<T> aMinusB;
+	set_difference(a.begin(), a.end(), b.begin(), b.end(), std::inserter(aMinusB, aMinusB.begin()));
+
+	list<T> bMinusA;
+	set_difference(b.begin(), b.end(), a.begin(), a.end(), std::inserter(bMinusA, bMinusA.begin()));
+
+	for(typename list<T>::const_iterator iter = aMinusB.begin(); iter != aMinusB.end(); iter++) {
+		cout << "< " << *iter << endl;
+	}
+	cout << "---" << endl;
+	for(typename list<T>::const_iterator iter = bMinusA.begin(); iter != bMinusA.end(); iter++) {
+		cout << "> " << *iter << endl;
+	}
+}
+
+void Diff::printDiff(const automaton::UnknownAutomaton& a, const automaton::UnknownAutomaton& b) {
+	cout << "AutomataDiffer" << endl;
+
+	if(a.getBlankSymbol() != b.getBlankSymbol()) {
+		cout << "Blank symbol" << endl;
+
+		cout << "< " << a.getBlankSymbol() << endl;
+		cout << "---" << endl;
+		cout << "> " << b.getBlankSymbol() << endl;
+	}
+
+	if(a.getFinalStates() != b.getFinalStates()){
+		cout << "FinalStates" << endl;
+
+		Diff::setDiff(a.getFinalStates(), b.getFinalStates());
+	}
+
+	if(a.getInitialStates() != b.getInitialStates()){
+		cout << "InitialStates" << endl;
+
+		Diff::setDiff(a.getInitialStates(), b.getInitialStates());
+	}
+
+	if(a.getInputAlphabet() != b.getInputAlphabet()) {
+		cout << "InputAlphabet" << endl;
+
+		Diff::setDiff(a.getInputAlphabet(), b.getInputAlphabet());
+	}
+
+	if(a.getStackAlphabet() != b.getStackAlphabet()) {
+		cout << "StackAlphabet" << endl;
+
+		Diff::setDiff(a.getStackAlphabet(), b.getStackAlphabet());
+	}
+
+	if(a.getStartSymbols() != b.getStartSymbols()) {
+		cout << "StartSymbols" << endl;
+
+		Diff::listDiff(a.getStartSymbols(), b.getStartSymbols());
+	}
+
+	if(a.getStates() != b.getStates()) {
+		cout << "States" << endl;
+
+		Diff::setDiff(a.getStates(), b.getStates());
+	}
+
+	if(a.getTapeAlphabet() != b.getTapeAlphabet()) {
+		cout << "TapeAlphabet" << endl;
+
+		Diff::setDiff(a.getTapeAlphabet(), b.getTapeAlphabet());
+	}
+
+	if(a.getTransitions() != b.getTransitions()) {
+		cout << "Transitions" << endl;
+
+		Diff::setDiff(a.getTransitions(), b.getTransitions());
+	}
+}
+
+void Diff::diff(const automaton::UnknownAutomaton& a, const automaton::UnknownAutomaton& b) {
+	if(!Diff::testDiff(a, b)) Diff::printDiff(a, b);
+}
diff --git a/adiff/src/Diff.h b/adiff/src/Diff.h
new file mode 100644
index 0000000000..9422f649b9
--- /dev/null
+++ b/adiff/src/Diff.h
@@ -0,0 +1,27 @@
+/*
+ * Diff.h
+ *
+ *  Created on: Apr 1, 2013
+ *      Author: honza
+ */
+
+#ifndef DIFF_H_
+#define DIFF_H_
+
+#include <ostream>
+
+#include <automaton/UnknownAutomaton.h>
+#include <map>
+#include <utility>
+
+class Diff {
+	static bool testDiff(const automaton::UnknownAutomaton& a, const automaton::UnknownAutomaton& b);
+	static void printDiff(const automaton::UnknownAutomaton& a, const automaton::UnknownAutomaton& b);
+
+	template <class T> static void setDiff(const std::set<T> a, const std::set<T> b);
+	template <class T> static void listDiff(const std::list<T> a, const std::list<T> b);
+public:
+	static void diff(const automaton::UnknownAutomaton& a, const automaton::UnknownAutomaton& b);
+};
+
+#endif /* DOTCONVERTER_H_ */
diff --git a/adiff/src/adiff.cpp b/adiff/src/adiff.cpp
new file mode 100644
index 0000000000..fd7398f41a
--- /dev/null
+++ b/adiff/src/adiff.cpp
@@ -0,0 +1,43 @@
+//============================================================================
+// Name        : aconvert.cpp
+// Author      : Martin Zak
+// Version     :
+// Copyright   : 
+// Description :
+//============================================================================
+
+#include <iostream>
+
+#include "automaton/UnknownAutomaton.h"
+#include "AutomatonFactory.h"
+#include "AlibException.h"
+
+using namespace std;
+using namespace automaton;
+using namespace alib;
+
+#include "Diff.h"
+
+int main(int argc, char** argv) {
+
+	UnknownAutomaton automaton1;
+	UnknownAutomaton automaton2;
+
+	try {
+
+		if (argc == 2 && string("-h").compare(argv[1]) == 0) {
+			cout << "Automaton diff.\nUsage: adiff automaton.xml automaton.xml\n";
+			return -1;
+		}
+
+		if (argc == 3) {
+			automaton1 = AutomatonFactory::fromFile(argv[1]);
+			automaton2 = AutomatonFactory::fromFile(argv[2]);
+		}
+
+		Diff::diff(automaton1, automaton2);
+	} catch (AlibException& e) {
+		cout << e.getCause() << endl;
+		return 0;
+	}
+}
-- 
GitLab