diff --git a/src/tmltranslator/TMLCPError.java b/src/tmltranslator/TMLCPError.java
new file mode 100755
index 0000000000000000000000000000000000000000..a7b8960dd00eb4fadfa812c59da4341c16070f6b
--- /dev/null
+++ b/src/tmltranslator/TMLCPError.java
@@ -0,0 +1,70 @@
+/**Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille
+ *
+ * ludovic.apvrille AT enst.fr
+ *
+ * This software is a computer program whose purpose is to allow the
+ * edition of TURTLE analysis, design and deployment diagrams, to
+ * allow the generation of RT-LOTOS or Java code from this diagram,
+ * and at last to allow the analysis of formal validation traces
+ * obtained from external tools, e.g. RTL from LAAS-CNRS and CADP
+ * from INRIA Rhone-Alpes.
+ *
+ * This software is governed by the CeCILL  license under French law and
+ * abiding by the rules of distribution of free software.  You can  use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and  rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty  and the software's author,  the holder of the
+ * economic rights,  and the successive licensors  have only  limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading,  using,  modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean  that it is complicated to manipulate,  and  that  also
+ * therefore means  that it is reserved for developers  and  experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and,  more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ *
+ * /**
+ * Class TMLCPError
+ * Used for storing a TML error generated by a TMLCP syntax checking process
+ * Creation: 12/09/2007
+ * @version 1.0 12/09/2007
+ * @author Ludovic APVRILLE
+ * @see
+ */
+
+
+package tmltranslator;
+
+import tmltranslator.tmlcp.*;
+
+public class TMLCPError {
+    
+    // type
+    public final static int ERROR_STRUCTURE = 0;
+    public final static int WARNING_STRUCTURE = 1;   
+		public final static int ERROR_BEHAVIOR = 2;
+    public final static int WARNING_BEHAVIOR = 3;
+    
+    public int type; // ERROR, WARNING
+    public String message;
+		public TMLTask task;
+		//public reference to the diagram...
+		public TMLActivityElement element;
+		public TMLCPElement cpElement;
+    
+    public TMLCPError( int _type ) {
+        type = _type;
+    }
+}
diff --git a/src/tmltranslator/TMLCPSyntaxChecking.java b/src/tmltranslator/TMLCPSyntaxChecking.java
index 035a44b3f8e007b91db33f02067c6cb5b2ff777c..9c0dc1ecfa5eead559985f7d4cb24c1a7010b579 100755
--- a/src/tmltranslator/TMLCPSyntaxChecking.java
+++ b/src/tmltranslator/TMLCPSyntaxChecking.java
@@ -71,8 +71,8 @@ public class TMLCPSyntaxChecking {
 	private final String TIME_UNIT_ERROR = "unknown time unit";
 	
 	
-	private ArrayList<TMLError> errors;
-	private ArrayList<TMLError> warnings;
+	private ArrayList<TMLCPError> errors;
+	private ArrayList<TMLCPError> warnings;
 	private TMLCP tmlcp;
 	private TMLMapping mapping;
   
@@ -88,8 +88,8 @@ public class TMLCPSyntaxChecking {
 	
 	public void checkSyntax() {
 		
-		errors = new ArrayList<TMLError>();
-		warnings = new ArrayList<TMLError>();
+		errors = new ArrayList<TMLCPError>();
+		warnings = new ArrayList<TMLCPError>();
 		
 		//TraceManager.addDev( "Checking syntax" );
 		//Call here the routines to performan syntax checks
@@ -100,21 +100,109 @@ public class TMLCPSyntaxChecking {
 
 	private void checkMainCP()	{
 		TMLCPActivityDiagram mainCP = tmlcp.getMainCP();
+		ArrayList<String> listConnectorsStartEndNames = new ArrayList<String>();
+		ArrayList<String> listDiagramNames = new ArrayList<String>();
+		//check that all diagrams are connected
+
+		ArrayList<TMLCPElement> listElements = mainCP.getElements();
+		for( TMLCPElement elem : listElements )	{
+			if( elem instanceof tmltranslator.tmlcp.TMLCPRefAD )	{
+				listDiagramNames.add(((tmltranslator.tmlcp.TMLCPRefAD)elem).getName() );
+			}
+			if( elem instanceof tmltranslator.tmlcp.TMLCPRefSD )	{
+				listDiagramNames.add(((tmltranslator.tmlcp.TMLCPRefSD)elem).getName() );
+			}
+			if( elem instanceof TMLCPConnector )	{
+				listConnectorsStartEndNames.add( ((TMLCPConnector)elem).getEndName() );
+				listConnectorsStartEndNames.add( ((TMLCPConnector)elem).getStartName() );
+			}
+		}
+
+		for( String s: listDiagramNames )	{
+			if( !listConnectorsStartEndNames.contains(s) )	{
+				TraceManager.addDev( "Diagram " + s + " has not been found to be connected!" );
+				addError( "Diagram " + s + " has not been found to be connected!", 0 );	//0 = missing diagram
+			}
+		}
 	}
 
 	private void checkActivityDiagrams()	{
 		ArrayList<TMLCPActivityDiagram> listADs = tmlcp.getCPActivityDiagrams();
+
+		ArrayList<String> listConnectorsStartEndNames = new ArrayList<String>();
+		ArrayList<String> listDiagramNames = new ArrayList<String>();
+		//check that all diagrams are connected
+
+		for( TMLCPActivityDiagram diag: listADs )	{
+			ArrayList<TMLCPElement> listElements = diag.getElements();
+			for( TMLCPElement elem : listElements )	{
+				if( elem instanceof tmltranslator.tmlcp.TMLCPRefAD )	{
+					listDiagramNames.add(((tmltranslator.tmlcp.TMLCPRefAD)elem).getName() );
+				}
+				if( elem instanceof tmltranslator.tmlcp.TMLCPRefSD )	{
+					listDiagramNames.add(((tmltranslator.tmlcp.TMLCPRefSD)elem).getName() );
+				}
+				if( elem instanceof TMLCPConnector )	{
+					listConnectorsStartEndNames.add( ((TMLCPConnector)elem).getEndName() );
+					listConnectorsStartEndNames.add( ((TMLCPConnector)elem).getStartName() );
+				}
+			}
+			for( String s: listDiagramNames )	{
+				if( !listConnectorsStartEndNames.contains(s) )	{
+					TraceManager.addDev( "Diagram " + s + " is not connected in diagram " + diag.getName() );
+					addError( "Diagram " + s + " is not connected in diagram " + diag.getName(), TMLCPError.ERROR_STRUCTURE );
+				}
+			}
+			listConnectorsStartEndNames = new ArrayList<String>();
+			listDiagramNames = new ArrayList<String>();
+		}
 	}
 
 	private void checkSequenceDiagrams()	{
 		ArrayList<TMLCPSequenceDiagram> listSDs = tmlcp.getCPSequenceDiagrams();
-		checkVariables( listSDs );
-		/*checkMessages( listSDs);
-		checkActions( listSDs );
-		checkInstances(listSDs );*/
+
+		for( TMLCPSequenceDiagram diag: listSDs )	{
+			ArrayList<TMLAttribute> attributes = diag.getAttributes();
+			checkMessages( diag, attributes );	// check that variables have been declared
+			//checkActions( diag, attributes );			// actions must be done on variables that have
+																						//	been declared and coherently boolean = boolean + 6 is not allowed
+			checkInstances( diag );	// instances within the same SD must all have different names
+		}
 	}
 
-	private void	checkVariables( ArrayList<TMLCPSequenceDiagram> listSDs )	{
+	private void checkMessages( TMLCPSequenceDiagram diag, ArrayList<TMLAttribute> attributes )	{
+		ArrayList<TMLSDMessage> messages = diag.getMessages();
+		for( TMLSDMessage msg: messages )	{
+			ArrayList<TMLSDAttribute> attributesMsg = msg.getAttributes();
+			for( TMLSDAttribute attr: attributesMsg )	{
+				if( !attributes.contains( attr ) )	{	//class TMLSDMessage must have the method equals defined
+					TraceManager.addDev( " Attribute " + attr + " does not exist in diagram " + diag.getName()  );
+					addError( " Attribute " + attr + " does not exist in diagram " + diag.getName(), TMLCPError.ERROR_STRUCTURE );
+				}
+			}
+		}
+	}
+
+	private void checkActions( TMLCPSequenceDiagram diag, ArrayList<TMLAttribute> attributes )	{
+		ArrayList<TMLSDAction> actions = diag.getActions();
+		for( TMLSDAction action: actions )	{
+			parsing2( action.getAction() );
+			//for each action look for the corresponding attribute and check if the action is correct
+		}
+	}
+
+	private void checkInstances( TMLCPSequenceDiagram diag )	{
+		ArrayList<TMLSDInstance> instances = diag.getInstances();
+		HashSet hash = new HashSet();
+		for( TMLSDInstance instance: instances )	{
+			if( !hash.contains( instance.getName() ) )	{
+				hash.add( instance.getName() );
+			}
+			else	{
+				TraceManager.addDev( "Error double instance name " + instance.getName() + " in diagram " + diag.getName()  );
+				addError( "Instance " + instance.getName() + " is declared multiple times in diagram " + diag.getName(), TMLCPError.ERROR_STRUCTURE );
+			}
+		}
 	}
 		
 	public int hasErrors()	{
@@ -131,20 +219,26 @@ public class TMLCPSyntaxChecking {
 		return warnings.size();
 	}
 	
-	public ArrayList<TMLError> getErrors() {
+	public ArrayList<TMLCPError> getErrors() {
 		return errors;
 	}
 	
-	public ArrayList<TMLError> getWarnings() {
+	public ArrayList<TMLCPError> getWarnings() {
 		return warnings;
 	}
 
-	public void addError( TMLTask t, TMLActivityElement elt, String message, int type )	{
+/*	public void addError( TMLTask t, TMLActivityElement elt, String message, int type )	{
 		TMLError error = new TMLError( type );
 		error.message = message;
 		error.task = t;
 		error.element = elt;
 		errors.add( error );
+	}*/
+
+	public void addError( String message, int type )	{
+		TMLCPError error = new TMLCPError( type );
+		error.message = message;
+		errors.add( error );
 	}
 
 	public String printSummary() {
@@ -164,17 +258,90 @@ public class TMLCPSyntaxChecking {
 	
 	public String printErrors() {
 		String ret = "*** ERRORS:";
-		for( TMLError error: errors )	{
-			ret += "ERROR / task " + error.task.getName() + " / element " + error.element.getName() + ": " + error.message + "\n";
+		for( TMLCPError error: errors )	{
+			ret += "ERROR: " + error.message;
 		}
 		return ret;
 	}
 	
 	public String printWarnings() {
 		String ret = "";
-		for( TMLError error: warnings ) {
+		for( TMLCPError error: warnings ) {
 			ret += "ERROR / task " + error.task.getName() + " / element: " + error.element.getName() + ": " + error.message + "\n";
 		}
 		return ret;
 	}
+
+	public void parsing2( String parseCmd, String action) {
+		TMLExprParser parser;
+		SimpleNode root;
+		
+		// First parsing
+		parser = new TMLExprParser(new StringReader(parseCmd + " " + action));
+		try {
+			//System.out.println("\nParsing :" + parseCmd + " " + action);
+			root = parser.CompilationUnit();
+			//root.dump("pref=");
+			//System.out.println("Parse ok");
+		} catch (ParseException e) {
+			//System.out.println("ParseException --------> Parse error in :" + parseCmd + " " + action);
+			addError( SYNTAX_ERROR + " in expression " + action, TMLError.ERROR_BEHAVIOR);
+			return;
+		} catch (TokenMgrError tke ) {
+			//System.out.println("TokenMgrError --------> Parse error in :" + parseCmd + " " + action);
+			addError( SYNTAX_ERROR + " in expression " + action, TMLError.ERROR_BEHAVIOR);
+			return;
+		}  
+		
+		// Second parsing
+		// We only replace variables values after the "=" sign
+		if (parseCmd.compareTo("natnumeral") == 0) {
+			return;
+		}
+		
+		int index = action.indexOf('=');
+		String modif = action;
+		
+		if ((parseCmd.compareTo("assnat") ==0) || (parseCmd.compareTo("assbool") ==0)) { 
+			if (index != -1) {
+				modif = action.substring(index+1, action.length());
+			}
+			
+			if (parseCmd.compareTo("assnat") ==0) {
+				parseCmd = "actionnat";
+			} else {
+				parseCmd = "actionbool";
+			}
+		}
+		
+		if (parseCmd.compareTo("natid") == 0) {
+			parseCmd = "natnumeral";
+		}
+		
+		for(TMLAttribute attr: t.getAttributes()) {
+			modif = tmlm.putAttributeValueInString(modif, attr);
+		}
+		parser = new TMLExprParser(new StringReader(parseCmd + " " + modif));
+		try {
+			//System.out.println("\nParsing :" + parseCmd + " " + modif);
+			root = parser.CompilationUnit();
+			//root.dump("pref=");
+			//System.out.println("Parse ok");
+		} catch (ParseException e) {
+			//System.out.println("ParseException --------> Parse error in :" + parseCmd + " " + action);
+			addError( VARIABLE_ERROR + " in expression " + action, TMLError.ERROR_BEHAVIOR);
+			return;
+		} catch (TokenMgrError tke ) {
+			//System.out.println("TokenMgrError --------> Parse error in :" + parseCmd + " " + action);
+			addError( VARIABLE_ERROR + " in expression " + action, TMLError.ERROR_BEHAVIOR);
+			return;
+		}  
+		
+		// Tree analysis: if the tree contains a variable, then, this variable has not been declared
+		ArrayList<String> vars = root.getVariables();
+		for(String s: vars) {
+			addError( UNDECLARED_VARIABLE + " :" + s + " in expression " + action, TMLError.ERROR_BEHAVIOR);
+		}
+		
+	}
 }	//End of class
diff --git a/src/tmltranslator/TMLSDAttribute.java b/src/tmltranslator/TMLSDAttribute.java
index 0987c1de218234560b83f04d8ca47825d0b2912b..4adddf47466ad41c8f65d4aed8c3d61868a9f82a 100755
--- a/src/tmltranslator/TMLSDAttribute.java
+++ b/src/tmltranslator/TMLSDAttribute.java
@@ -110,4 +110,24 @@ public class TMLSDAttribute extends DIPLOElement {
 			}
 			return "unknown";
 		}
+
+		@Override public boolean equals( Object o )	{
+			if( o == null )	{
+				return false;
+			}
+			if( !(o instanceof TMLSDAttribute ) )	{
+				return false;
+			}
+			TMLSDAttribute mt = (TMLSDAttribute) o;
+			if( !this.initialValue.equals( mt.initialValue ) )	{
+				return false;
+			}
+			if( !this.name.equals( mt.name ) )	{
+				return false;
+			}
+			if( !this.type.equals( mt.type ) )	{
+				return false;
+			}
+			return true;
+		}
 }	//End of class
diff --git a/src/tmltranslator/TMLSDType.java b/src/tmltranslator/TMLSDType.java
index 031123a4886810b510ecffc03a24d1249cd0e395..e7e85c43339b074fdb823ba05293e4b9d76621a9 100755
--- a/src/tmltranslator/TMLSDType.java
+++ b/src/tmltranslator/TMLSDType.java
@@ -146,4 +146,21 @@ public class TMLSDType {
     public String toString() {
         return getStringType( type );
     }
+
+		@Override public boolean equals( Object o )	{
+			if( o == null ) {
+				return false;
+			}
+			if( !(o instanceof TMLSDType ) ) {
+				return false;
+			}
+			TMLSDType mt = (TMLSDType) o;
+		 	if( this.type != mt.type )  {
+				return false;
+			}
+			if( !this.typeOther.equals( mt.typeOther ) )  {
+				return false;
+			}
+			return true;
+		}
 }	//End of class
diff --git a/src/tmltranslator/TMLSyntaxChecking.java b/src/tmltranslator/TMLSyntaxChecking.java
index e573cfd73a323536d177f8e96d329c10890f84f0..2e2cd9681d303da80de48dcd957b235e9f6baf29 100755
--- a/src/tmltranslator/TMLSyntaxChecking.java
+++ b/src/tmltranslator/TMLSyntaxChecking.java
@@ -461,7 +461,7 @@ public class TMLSyntaxChecking {
 		}
 		
 	}
-	
+
 	public String printSummary() {
 		String ret = "";
 		if (errors.size() == 0) {
@@ -493,4 +493,4 @@ public class TMLSyntaxChecking {
 		return ret;
 	}
 	
-}
\ No newline at end of file
+}
diff --git a/src/ui/GTMLModeling.java b/src/ui/GTMLModeling.java
index 82011d929d208879e6537765d39342c65faa3508..1644a0b3499a2dbdd0a2c8683ddc0a07b870e6d7 100755
--- a/src/ui/GTMLModeling.java
+++ b/src/ui/GTMLModeling.java
@@ -1920,29 +1920,31 @@ public class GTMLModeling  {
 		TraceManager.addDev( "About to check the syntax of CPs" );
 		TMLCPSyntaxChecking syntax = new TMLCPSyntaxChecking( tmlcp );
 		syntax.checkSyntax();
+		//Takes the data structure tmlcp passed to the constructor and checks the syntax of the components of a cp. If there are errors (these
+		//are filled inside the class syntax), then CheckingErrors are filled according to the errors in class syntax
 
 		CheckingError ce;
 		int type;
 		TGComponent tgc;
 		
-		/*if( syntax.hasErrors() >0 ) {
-			for( TMLError error: syntax.getErrors() ) {
-				if( error.type == TMLError.ERROR_STRUCTURE ) {
+		if( syntax.hasErrors() > 0 ) {
+			for( TMLCPError error: syntax.getErrors() ) {
+				if( error.type == TMLCPError.ERROR_STRUCTURE ) {
 					type = CheckingError.STRUCTURE_ERROR;
 				}
 				else {
 					type = CheckingError.BEHAVIOR_ERROR;
 				}
 				ce = new CheckingError( type, error.message );
-				tgc = listE.getTG( error.element );
+				/*tgc = listE.getTG( error.element );
 				if ( tgc != null ) {
 					ce.setTDiagramPanel( tgc.getTDiagramPanel() );
 					ce.setTGComponent( tgc );
 				}
-				ce.setTMLTask( error.task );
+				ce.setTMLTask( error.task );*/
 				checkingErrors.add( ce );
 			}
-		}*/
+		}
 
 		//makeCPDataStructure();
 		/*if (!makeTMLModeling()) {
diff --git a/src/ui/GTURTLEModeling.java b/src/ui/GTURTLEModeling.java
index dcc9d5304d9bd9e142089e7b2ed0ad801b59a556..64c4b75cd02dba8f3b65db8608e1d7929833b5f7 100755
--- a/src/ui/GTURTLEModeling.java
+++ b/src/ui/GTURTLEModeling.java
@@ -6425,14 +6425,14 @@ public class GTURTLEModeling {
 			TraceManager.addDev( "Printing listE.getPanelNames: " + listE.getPanelNames().toString() );
 			TraceManager.addDev( "Printing listE.getData: " + listE.getData().toString() );
 		//}
-		/*checkingErrors = gtmlm.getCheckingErrors();
+		checkingErrors = gtmlm.getCheckingErrors();
 		
 		if( (checkingErrors != null) && (checkingErrors.size() > 0) )	{
-			analyzeErrors();
-			warnings = gtmlm.getCheckingWarnings();
+			//analyzeErrors();
+			//warnings = gtmlm.getCheckingWarnings();
 			return false;
 		}
-		else {
+		/*else {
 			//tmcp.removeAllRandomSequences();
 			if( optimize )	{
 				warningsOptimize = tmap.optimize();
diff --git a/src/ui/window/JDialogReferenceCP.java b/src/ui/window/JDialogReferenceCP.java
index 5ce23c89dc04a1515ef95b14f24eb8c840d26b23..b0ed31a211f5dcd7755bff819013a12d70926471 100644
--- a/src/ui/window/JDialogReferenceCP.java
+++ b/src/ui/window/JDialogReferenceCP.java
@@ -89,8 +89,8 @@ public class JDialogReferenceCP extends javax.swing.JDialog implements ActionLis
 	private HashSet<String> sdTransferInstances = new HashSet<String>();
 	private HashSet<String> sdControllerInstances = new HashSet<String>();
 	
-	private Vector<String> mappableArchUnitsSL = new Vector<String>();
-	private Vector<String> sdInstancesSL = new Vector<String>();
+	private Vector<String> mappableArchUnitsSL;
+	private Vector<String> sdInstancesSL;
 	
 	private int indexListCPsNames = 0;
 	
@@ -235,6 +235,7 @@ public class JDialogReferenceCP extends javax.swing.JDialog implements ActionLis
 			c1.gridheight = 3;
 			panel1.add(new JLabel(" "), c1);
 			
+			sdInstancesSL = new Vector<String>();
 			createListsOfInstances();	//Create the array list of HashSets listInstancesHash from listCPs
 			if( sdInstancesSL.size() == 0 )	{	//protect against the case of a CP with no SDs
 				sdInstancesSL.add( EMPTY_INSTANCES_LIST );
@@ -254,6 +255,7 @@ public class JDialogReferenceCP extends javax.swing.JDialog implements ActionLis
 			c1.gridheight = 3;
 			panel1.add(new JLabel(" "), c1);
 			
+			mappableArchUnitsSL = new Vector<String>();
 			makeListOfMappableArchUnitsSL();
 			
 			//nineth line panel1