diff --git a/Labgen/a.out b/Labgen/a.out
index a7f31d8ddde3f96c4943183255bde0d4207c6297..ec9f63aae8488934de4dca48253c6242c673237c 100755
Binary files a/Labgen/a.out and b/Labgen/a.out differ
diff --git a/Labgen/labgen b/Labgen/labgen
index cd0167934fe91538b41a5337518646aea13c32bf..bbd91329f76d3eba512f856e6da02fe3c998f156 100755
Binary files a/Labgen/labgen and b/Labgen/labgen differ
diff --git a/Labgen/labgen.c b/Labgen/labgen.c
index 313e9273763e58e59446f18cf55c930b6210a8d5..4f68128b645c105f86844ffd0913e398a79aca86 100644
--- a/Labgen/labgen.c
+++ b/Labgen/labgen.c
@@ -1,9 +1,26 @@
 #include "labgen.h"
-Point size; /*Attention c'est la taille de l'énoncé. */
-/* char *** matrice = NULL ; */
-int in,out;
+#include<stdio.h>
+#include<stdlib.h>
+#include<string.h>
+char DIR[2] = {'N','SW'};
+char* DIR = calloc(8,sizeof(char));
+DIR[0] = "N";
+DIR[1] = "NE";
+DIR[2] = "E";
+DIR[3] = "SE";
+DIR[4] = "S";
+DIR[5] = "SW";
+DIR[6] = "W";
+DIR[7] = "NW";
+
+Point size;
+/*int in,out;*/
 variables listevars;
-
+variables listLAB;
+variables listIDENT;
+variables listCOUNT;
+Point in;
+/*Point** listOUT;*/
 
 /* Crée un nouveau point de coordonnées (c,l)
  * --> Attention : l'ordre n'est pas logique (colonne, ligne)
@@ -17,6 +34,15 @@ Point new_point(int c, int l)
 }
 
 
+/* Crée un pointeur de point de coodonnées (c,l) */
+Point* new_point_ptr(int c, int l){
+  Point* res;
+  res = malloc(sizeof(Point));
+  *res = new_point(c,l);
+  return res;
+}
+
+
 /* Crée une matrice de taille (s1, s2)
  * --> Attention : l'ordre n'est pas logique (colonne, ligne)
  * s1 est le nombre de colonnes
@@ -37,8 +63,8 @@ char*** create_matrice(int s1, int s2)
       }
   }
   size = new_point(s1,s2);
-  in = 0;
-  out = 0;
+  /*in = 0;
+  out = 0;*/
   return matrice;
 }
 
@@ -83,39 +109,243 @@ void change_val_matrice(Point p, char * msg, char*** matrice)
 
 
 
-/*void ligne(){
+void ligne(Point sizeLAB){
   int	j;
-  for (j=0;j<size.l;j++)
-    printf(" -------");
+  printf(" +");
+  for (j=0;j<=sizeLAB.c;j++)
+    printf("----+");
   printf("\n");
-}*/
+}
 
-void affichmat(char*** matrice) {
+void affichmat(char*** matrice, Point sizeLAB) {
   int	i,j;
+  char* tmp;
+
+  printf(" ");
+  for (i=0; i<=sizeLAB.c; i++){
+    printf("   %d ",i);
+  }
+  printf("\n");
 
-  /*ligne();*/
-  for(i=0;i<=size.l;i++){
-    for(j=0;j<=size.c;j++){
-      printf("|%s \t",matrice[i][j]);
+  ligne(sizeLAB);
+  for(i=0;i<=sizeLAB.l;i++){
+    printf("%d",i);
+    for(j=0;j<=sizeLAB.c;j++){
+      tmp = matrice[i][j];
+      if (strcmp(tmp,"") == 0){
+        printf("|    ");
+      }
+      else
+        printf("| %s ",tmp);
     }
     printf("|\n");
-    /*ligne();*/
+    ligne(sizeLAB);
+  }
+}
+
+/* Crée un tableau de pointeurs à une dimension */
+Point** init_tab(Point size){
+  Point** res;
+  int i;
+  int taille = (size.c+1) * (size.l+1);
+
+  res = calloc(taille,sizeof(Point*));
+  for (i=0 ; i<taille ; i++)
+    res[i] = malloc(sizeof(Point));
+  return res;
+}
+
+char* concat_string(char *s1,char *s2) {
+   char *s3[100];
+   strcat(s3,s1);
+   strcat(s3,s2);
+   return s3;
+}
+
+/* Vérifie que deux points sont identiques
+ * Si égaux retourne 1, sinon retourne 0 */
+int equals_pt(Point pt1, Point pt2){
+  if (pt1.c == pt2.c && pt1.l == pt2.l)
+    return 1;
+  return 0;
+}
+
+
+/* Ajouter pt à tab */
+Point** add_tab(Point pt, Point** tab, int taille){
+  int i;
+  /* Ajouter condition quand dépassement de taille */
+  /* On vérifie que le point à mettre n'est pas déjà dans tab */
+  for (i=0 ; i<taille ; i++){
+    if (1 == equals_pt(pt,*(tab[i]))){
+      /*listCOUNT = increment_var(ident,listCOUNT);*/
+      return tab;
+    }
+  }
+  /*Vérifier pour l'incrémentation de la taille*/
+  *(tab[taille]) = pt;
+  return tab;
+}
+
+
+void check_obligatoire(variables listCount){
+  if (find_var("IN",listCount) == -1){
+    fprintf(stderr,"Erreur : IN n'existe pas.");
+    exit(1);
+  }
+
+  if (find_var("OUT",listCount) == -1){
+    fprintf(stderr,"Erreur : OUT n'existe pas.\n");
+    exit(1);
+  }
+
+  if (find_var("SIZE",listCount) == -1){
+    fprintf(stderr,"Erreur : SIZE n'existe pas.\n");
+    exit(1);
   }
-  /*ligne();*/
 }
 
+/*int check_show(char* id, variables listevars){
+  int index = find_var(id,listevars);
+  if (index == -1){
+    fprintf(stderr,"Erreur : %s n'existe pas.\n",id);
+    exit(1);
+  }
+  return index;
+}*/
+
+/* La fonction show permet l'affichage de la matrice du labyrinthe
+ * listLAB contient toutes les informations sur le labyrinthe
+ * On suppose qu'on a dans listLAB:
+ * - SIZEc : la colonne de SIZE
+ * - SIZEl : la ligne de SIZE
+ * - INc : la colonne de IN
+ * - INl : la ligne de IN
+ * - OUTc : la colonne de OUT
+ * - OUTl : la ligne de OUT  */
+
+ /* Conventions finales :
+  * - Point size
+  * - Point in
+  * - Point** listOUT (tableau de pointeurs sur un Point OUT)
+  * - Point** listWALL (tableau de pointeurs sur un Point WALL)
+  * - Point** listTDV (tableau de pointeurs sur un Point TDV)
+  * - varpoint*** listPM (tableau de pointeurs sur un pointeur pointant sur un listevars)
+  * -  */
+void show(Point size, Point in, Point** listOUT, Point** listWALL,
+          Point** listTDV, varpoint** listPM, variables listCOUNT){
+  char*** mat;
+  int i,n;
+  int index;
+  Point pt;
+  varpoint var;
+  char s[100];
+
+  /* Vérifie qu'on a des informations sur la taille, l'entrée et au moins
+   * une sortie du labyrinthe */
+  check_obligatoire(listCOUNT);
+  mat = create_matrice(size.c,size.l);
+
+  /* Ajout de l'entrée*/
+  change_val_matrice(in,"E ",mat);
+
+  /* Ajout des sorties */
+  n=value_var("OUT",listCOUNT);
+  for (i=0 ; i<n ; i++){
+    pt = *(listOUT[i]);
+    change_val_matrice(pt,"O ",mat);
+  }
+
+  /* Ajout des murs */
+  n=value_var("WALL",listCOUNT);
+  for (i=0 ; i<n ; i++){
+    pt = *(listWALL[i]);
+    change_val_matrice(pt,"* ",mat);
+  }
+
+  /* Ajout des trous de vers */
+  n=value_var("TDV",listCOUNT);
+  for (i=0 ; i<n ; i=i+2){
+    pt = *(listTDV[i]);
+    sprintf(s,"%d",i);
+
+    char chaine1[100] = "W";
+    char chaine2[100] = "w";
+    strcat(chaine1,s);
+    strcat(chaine2,s);
+
+    change_val_matrice(pt,chaine1,mat);
+    pt = *(listTDV[i+1]);
+    change_val_matrice(pt,chaine2,mat);
+  }
+
+  /* Ajout des portes magiques */
+  n = value_var("PM",listCOUNT);
+  for (i=0 ; i<n ; i++){
+    var = *(listPM[i]);
+    index=find_varpoint("DEP",var);
+    if (index==-1){
+      fprintf(stderr,"Erreur : pas de point de départ de porte magique.\n");
+      exit(1);
+    }
+    pt = value_varpoint("DEP",var);
+    change_val_matrice(pt,"A ",mat);
+
+    for (i=0 ; i<8 ; i++){
+      if ((index = find_varpoint(DIR[i],var)) != -1){
+        pt = value_varpoint(DIR[i],var);
+
+        sprintf(s,"%d",i);
+        char chaine1[100] = "a";
+        strcat(chaine1,s);
+
+        change_val_matrice(pt,chaine1,mat);
+      }
+    }
+
+    /*if ((index = find_varpoint("N",var)) != -1){
+      pt = value_varpoint("N",var);
+      change_val_matrice(pt,"AN",mat);
+    }
+
+    if ((index = find_varpoint("E",var)) != -1){
+      pt = value_varpoint("E",var);
+      change_val_matrice(pt,"AE",mat);
+    }
+
+    if ((index = find_varpoint("W",var)) != -1){
+      pt = value_varpoint("W",var);
+      change_val_matrice(pt,"AW",mat);
+    }
+
+    if ((index = find_varpoint("S",var)) != -1){
+      pt = value_varpoint("S",var);
+      change_val_matrice(pt,"AS",mat);
+    }*/
+  }
+
+
+  affichmat(mat,size);
+
+}
+
+/******************************************************************************/
+/* Fonctions de base de listevars                                             */
+/******************************************************************************/
 
 
 /* Initialise listevars */
-void init_listevars(){
-  listevars.last = 0;
+variables init_listevars(){
+  variables res;
+  res.last = 0;
+  return res;
 }
 
 
 /* Vérifie si var est dans listevars :
- * - si oui, renvoie l'adresse correspondante
-   - sinon, renvoie NULL */
-int find_var(char* var) {
+ * - si oui, renvoie l'indice correspondante
+   - sinon, renvoie -1 */
+int find_var(char* var,variables listevars) {
   int i;
   int ret;
 
@@ -129,13 +359,24 @@ int find_var(char* var) {
 }
 
 
+/* Renvoie la valeur de l'identifiant var dans la liste listevars */
+int value_var(char* var,variables listevars){
+  int index = find_var(var,listevars);
+  if (index == -1){
+    fprintf(stderr,"Aucune valeur ne correspond à %s.\n",var);
+    exit(1);
+  }
+  return listevars.val[index];
+}
+
+
 /* Modifie la valeur de la variable :
  * - Si "nom" fait partie de la liste des variables, alors la variable est
  *   directement modifiée
  * - Sinon rajoute le nom de la variable et sa valeur dans listevars
      si la taille de listevars le permet */
-void create_modif_var(char* nom, int val) {
-  int index = find_var(nom);
+variables create_modif_var(char* nom, int val, variables listevars) {
+  int index = find_var(nom,listevars);
 
   if (index != -1)
   {
@@ -147,133 +388,203 @@ void create_modif_var(char* nom, int val) {
     	printf("Il n'y a plus de place pour tous ces variables.\n");
     	exit(1);
   	}
-  	else
+  	else{
    	  listevars.ident[listevars.last] = malloc(strlen(nom)*sizeof(char));
+    }
 
    	strcpy(listevars.ident[listevars.last],nom);
    	listevars.val[listevars.last] = val;
    	listevars.last++;
   }
+  return listevars;
+
 }
+ /* ---------------> on peut y gérer l'unicité */
+/* Incrémente la valeur de l'identifiant :
+ * - si l'identifiant existe dans listevars, il incrémente la valeur existante
+ * - sinon, il crée l'identifiant et l'initialise à 1
+ * Utile pour listCOUNT */
+variables increment_var(char* nom,variables listevars){
+  int index = find_var(nom,listevars);
 
+  if (index != -1)
+    listevars.val[index] ++;
 
-/* Règles sémantiques :
- * Retourne 1 quand c'est correct
- * Retourne 0 sinon */
+  else{
+  	if (listevars.last > TAILLE) {
+    	printf("Il n'y a plus de place pour tous ces variables.\n");
+    	exit(1);
+  	}
+  	else{
+   	  listevars.ident[listevars.last] = malloc(strlen(nom)*sizeof(char));
+    }
 
-/* RS1 : Le labyrinthe doit avoir au moins 2 lignes et au moins 2 colonnes */
-int RS1(Point size){
-  if (size.c >= 1 && size.l >= 1)
-    return 1;
-  printf("RS1 : Le labyrinthe doit avoir au moins 2 lignes et au moins 2 colonnes.\n");
-  return 0;
-}
+   	strcpy(listevars.ident[listevars.last],nom);
+   	listevars.val[listevars.last] = 1;
+   	listevars.last++;
+  }
 
-/* RS2_count : Le labyrinthe doit avoir une et une seule entrée */
-int RS2_count(int countE){
-  if (countE == 1)
-    return 1;
-  printf("RS2 : Le labyrinthe doit avoir une et une seule entrée.\n");
-  return 0;
+  return listevars;
 }
 
-/* RS2_check : L'entrée ne peut être ni une sortie ni une entrée de trou de vers */
-int RS2_check(){
-  /* A faire */
-  return 0;
+/******************************************************************************/
+/* Fonctions de base de listevarpoint                                         */
+/******************************************************************************/
+varpoint init_listevarpoint(){
+  varpoint res;
+  res.last = 0;
+  return res;
 }
 
-/* RS3_count : Le labyrinthe doit avoir au moins une sortie */
-int RS3_count(int countS){
-  if (countS >= 1)
-    return 1;
-  printf("RS3 : Le labyrinthe doit avoir au moins une sortie.\n");
-  return 0;
+
+/* Vérifie si var est dans list :
+ * - si oui, renvoie l'indice correspondante
+   - sinon, renvoie -1 */
+int find_varpoint(char* var,varpoint list) {
+  int i;
+  int ret;
+
+  for (i=0; i<list.last; i++) {
+    ret = strcmp(list.ident[i], var);
+    if (ret==0) {
+    return i;
+    }
+  }
+  return -1;
 }
 
-/* RS3_check : La sortie ne peut être ni l'entrée ni une entrée de trou de vers */
-int RS3_check(){
-  /* A faire */
-  return 0;
+
+/* Renvoie la valeur de l'identifiant var dans la liste list */
+Point value_varpoint(char* var,varpoint list){
+  int index = find_varpoint(var,list);
+  if (index == -1){
+    fprintf(stderr,"Aucune valeur ne correspond à %s.\n",var);
+    exit(1);
+  }
+  return *(list.val[index]);
 }
 
-/* RS4 : L'entrée et les sorties du labyrinthe doivent se situer sur la périphérie
- * du labyrinthe
- * E est le point d'entrée
- * S est un tableau dynamique de l'ensemble des sorties
- * nb_S est le nombre de sorties
- * size est un point donnant la taille du tableau */
-int RS4(Point E, Point* S, int nb_S, Point size){
-   int i;
-   Point tmp;
-
-   if (S == NULL){
-     fprintf(stderr,"RS4 : La liste des sorties est non initialisée.\n");
-     exit(1);
-   }
-
-   else if (nb_S == 0){
-     printf("RS4 : La liste des sorties est vide.\n");
-     return 0;
-   }
-
-   /* Vérification pour l'entrée */
-   else if (E.c != 0 && E.l != 0 && E.c != size.c && E.l != size.l){
-      return 0;
-   }
-
-   /* Vérification pour toutes les sorties */
-   else {
-     for (i=0 ; i<nb_S ; i++){
-       tmp = S[i];
-       if (tmp.c != 0 && tmp.l != 0 && tmp.c != size.c && tmp.l != size.l){
-          return 0;
-       }
-     }
-   }
-   return 1;
- }
-
-
-/* Test des fonctions pour les règles sémantiques */
-int main(){
-  char*** matrice = create_matrice(5,6);
-  Point size = new_point(5,6);
-
-  Point entree1 = new_point(0,0);
-  Point entree2 = new_point(5,6);
-  Point entree3 = new_point(5,0);
-  Point entree4 = new_point(0,5);
-
-  change_val_matrice(entree1,"E",matrice);
-  change_val_matrice(entree2,"E",matrice);
-  change_val_matrice(entree3,"E",matrice);
-  change_val_matrice(entree4,"E",matrice);
-
-
-  Point* listeS = NULL;
-  listeS = calloc(1,sizeof(Point));
-  listeS[0] = new_point(5,6);
-  /* A tester : pour plusieurs sorties */
-  change_val_matrice(new_point(5,6),"S",matrice);
-  affichmat(matrice);
-
-  printf("\nlisteS[0] : (%d,%d)\n",listeS[0].c, listeS[0].l);
-
-  printf("Test entree1 : %d\n", RS4(entree1,listeS,1,size));
-  printf("Test entree2 : %d\n", RS4(entree2,listeS,1,size));
-  printf("Test entree3 : %d\n", RS4(entree3,listeS,1,size));
-  printf("Test entree4 : %d\n", RS4(entree4,listeS,1,size));
 
+/* Modifie la valeur de la variable :
+ * - Si "nom" fait partie de la liste des variables, alors la variable est
+ *   directement modifiée
+ * - Sinon rajoute le nom de la variable et sa valeur dans listevars
+     si la taille de listevars le permet */
+varpoint create_modif_varpoint(char* nom, Point val, varpoint list) {
+  int index = find_varpoint(nom,list);
 
-  return 0;
-}
+  if (index != -1)
+  {
+    *(list.val[index]) = val;
+  }
+
+  else{
+  	if (list.last > TAILLE) {
+    	printf("Il n'y a plus de place pour tous ces variables.\n");
+    	exit(1);
+  	}
+  	else{
+   	  list.ident[list.last] = malloc(strlen(nom)*sizeof(char));
+      list.val[list.last] = malloc(sizeof(Point));
+    }
+
+   	strcpy(list.ident[list.last],nom);
+   	*(list.val[list.last]) = val;
+   	list.last++;
+  }
+  return list;
 
+}
 
 
 /* Test des fonctions de base de la matrice et de listevars */
-/*int main () {
-  char*** matrice = create_matrice(5,6);
+int main() {
+  /* Tester varpoint */
+  /*varpoint tmp;
+  Point* tmp_pt;
+  Point* tmp_pt2;
+  tmp_pt = new_point_ptr(2,3);
+  tmp_pt2 = new_point_ptr(2,4);
+  tmp = init_listevarpoint();
+  tmp = create_modif_varpoint("IDENT",*tmp_pt,tmp);
+  tmp = create_modif_varpoint("IDENT",*tmp_pt2,tmp);
+  Point res_value = value_varpoint("IDENT",tmp);
+  printf("listevarpoint tmp : (%d,%d)\n",res_value.c,res_value.l);*/
+
+  /*variables listLAB;
+  variables listCOUNT;
+  listLAB = init_listevars();
+  listLAB = create_modif_var("SIZEc",5,listLAB);
+  listLAB = create_modif_var("SIZEl",6,listLAB);
+  listCOUNT = increment_var("SIZE",listCOUNT);
+  listLAB = create_modif_var("INc",2,listLAB);
+  listLAB = create_modif_var("INl",0,listLAB);
+  listCOUNT = increment_var("IN",listCOUNT);
+  listLAB = create_modif_var("OUTc",5,listLAB);
+  listLAB = create_modif_var("OUTl",0,listLAB);
+  listCOUNT = increment_var("OUT",listCOUNT);*/
+
+  Point sizeLAB;
+  Point in;
+  Point** listOUT;
+  Point** listWALL;
+  Point** listTDV;
+  varpoint** listPM;
+  variables listCOUNT;
+
+  sizeLAB = new_point(5,6);
+  in = new_point(2,0);
+  listOUT = init_tab(sizeLAB);
+  listOUT = add_tab(new_point(0,5),listOUT,0);
+  /*Ajouter paramètre incrémentation taille */
+  listOUT = add_tab(new_point(5,0),listOUT,1);
+
+  listWALL = init_tab(sizeLAB);
+  listWALL = add_tab(new_point(3,0),listWALL,0);
+  listWALL = add_tab(new_point(3,1),listWALL,1);
+  listWALL = add_tab(new_point(4,2),listWALL,2);
+  listWALL = add_tab(new_point(4,3),listWALL,3);
+  listWALL = add_tab(new_point(5,4),listWALL,4);
+
+  listTDV = init_tab(sizeLAB);
+  listTDV = add_tab(new_point(3,4),listTDV,0);
+  listTDV = add_tab(new_point(2,5),listTDV,1);
+  listTDV = add_tab(new_point(0,1),listTDV,2);
+  listTDV = add_tab(new_point(0,3),listTDV,3);
+
+  int taille = (sizeLAB.c+1)*(sizeLAB.l+1);
+  int i;
+  listPM = calloc(taille,sizeof(varpoint*));
+  for (i=0 ; i<taille ; i++){
+    listPM[i] = malloc(sizeof(varpoint));
+  }
+
+  *listPM[0] = init_listevarpoint();
+  *listPM[0] = create_modif_varpoint("DEP",new_point(3,2),*listPM[0]);
+  *listPM[0] = create_modif_varpoint("W",new_point(0,0),*listPM[0]);
+  *listPM[0] = create_modif_varpoint("E",new_point(5,2),*listPM[0]);
+
+
+  listCOUNT = init_listevars();
+  listCOUNT = increment_var("IN",listCOUNT); /*la fonction incrémente si points non identiques*/
+  listCOUNT = increment_var("SIZE",listCOUNT);
+  listCOUNT = increment_var("OUT",listCOUNT);
+  listCOUNT = increment_var("OUT",listCOUNT);
+  listCOUNT = increment_var("WALL",listCOUNT);
+  listCOUNT = increment_var("WALL",listCOUNT);
+  listCOUNT = increment_var("WALL",listCOUNT);
+  listCOUNT = increment_var("WALL",listCOUNT);
+  listCOUNT = increment_var("WALL",listCOUNT);
+  listCOUNT = increment_var("TDV",listCOUNT);
+  listCOUNT = increment_var("TDV",listCOUNT);
+  listCOUNT = increment_var("TDV",listCOUNT);
+  listCOUNT = increment_var("TDV",listCOUNT);
+  listCOUNT = increment_var("PM",listCOUNT); /* on incrémente par porte d'entrée */
+
+
+  show(sizeLAB,in,listOUT,listWALL,listTDV,listPM,listCOUNT);
+
+  /*char*** matrice = create_matrice(5,6);
 
   Point p1 = new_point(4,2);
   printf("Point p1 (%d,%d)\n",p1.c,p1.l);
@@ -282,23 +593,22 @@ int main(){
   change_val_matrice(p1,"ABC",matrice);
   printf("Point p1 :%s\n", lecture(p1,matrice));
   printf("\nAppel de la fonction change_val_matrice(p1,DEF)\n");
-  change_val_matrice(p1, "DEF", matrice);
+  change_val_matrice(p1, "D", matrice);
   printf("Point p1 :%s\n", lecture(p1,matrice));
 
   printf("\nTaille de la matrice : (%d,%d)\n",size.c,size.l);
   printf("Matrice correspondante :\n");
-  affichmat(matrice);
-
-  init_listevars();
-  create_modif_var("IDENT",1);
-  create_modif_var("IDENT",2);
-  create_modif_var("IDENT",1);
-  create_modif_var("IDENT2",5);
-  printf("\n\nTaille listevars : %d\n",listevars.last);
+  affichmat(matrice,size);
+
+  listevars = init_listevars();
+  listevars = create_modif_var("IDENT",1,listevars);
+  listevars = create_modif_var("IDENT",2,listevars);
+  listevars = create_modif_var("IDENT",1,listevars);
+  listevars = create_modif_var("IDENT2",5,listevars);
   printf("Premier nom : %s\n",listevars.ident[0]);
   printf("Première valeur : %d\n",listevars.val[0]);
   printf("Deuxième nom : %s\n",listevars.ident[1]);
-  printf("Deuxième valeur : %d\n",listevars.val[1]);
+  printf("Deuxième valeur : %d\n",listevars.val[1]);*/
 
   return 0;
-}*/
+}
diff --git a/Labgen/labgen.h b/Labgen/labgen.h
index c943c5282df173286d2597e5c0ef6546d72d665f..68309da06050ebc510c66627522513c0ae4a8a02 100644
--- a/Labgen/labgen.h
+++ b/Labgen/labgen.h
@@ -1,6 +1,6 @@
-#include<stdio.h>
-#include<stdlib.h>
-#include<string.h>
+#ifndef _LABGEN_H
+#define _LABGEN_H
+
 #define TAILLE 255
 
 typedef struct {
@@ -8,19 +8,54 @@ int c;
 int l;
 } Point;
 
+typedef struct Point* point_ptr;
+
 typedef struct {
 char* ident[TAILLE];
 int val[TAILLE];
 int last;
 } variables;
 
+typedef struct {
+char* ident[TAILLE];
+Point* val[TAILLE];
+int last;
+} varpoint;
+
 Point new_point(int ,int);
+Point* new_point_ptr(int, int);
 
 char*** create_matrice(int,int);
 char* lecture(Point,char***);
 void change_val_matrice(Point,char*, char***);
-void affichmat(char***);
+void affichmat(char***,Point);
+
+variables init_listevars();
+int find_var(char*,variables);
+int value_var(char*,variables);
+variables create_modif_var(char*,int,variables);
+variables increment_var(char*,variables);
+
+varpoint init_listevarpoint();
+int find_varpoint(char* var,varpoint list);
+Point value_varpoint(char* var,varpoint list);
+varpoint create_modif_varpoint(char* nom, Point val, varpoint list);
+
+Point** init_tab(Point size);
+int equals_pt(Point pt1, Point pt2);
+Point** add_tab(Point pt, Point** tab, int taille);
+
+void show(Point size, Point in, Point** listOUT, Point** listWALL, Point** listTDV, varpoint** listPM, variables listCOUNT);
+int RS1(Point);
+int RS2_count(int);
+int RS3_count(int);
+int RS2_3_check(Point E, Point* listeS, int sizeS, Point* listeETV, int sizeETV);
+int RS4(Point E, Point* S, int nb_S, Point size);
+int RS5();  /* A remodifier */
+int RS6(Point* listeETV, int sizeETV, Point sizeLAB);
+int RS7(Point* listePM, int sizePM, Point sizeLAB);
+int RS8_PTA(Point* listePTA, int sizePTA, Point sizeLAB);
+int RS8_PTD(Point PTD, Point* wallptd, int sizeW, int* wallr, Point sizeLAB);
+int RS8_R(Point PTA1, Point PTA2, Point sizeLAB);
 
-void init_listevars();
-int find_var(char*);
-void create_modif_var(char*,int);
+#endif
diff --git a/Labgen/labgen.o b/Labgen/labgen.o
index faa8e7a8f832a1c5243512a18f60e5b1820c09fc..97b6c4cdb421dc5d3c4f9c66fb8ebd712b3ffb67 100644
Binary files a/Labgen/labgen.o and b/Labgen/labgen.o differ
diff --git a/Labgen/labgen.y b/Labgen/labgen.y
index fa40e2050ccf925441f6765c5e893ddbee981d08..b072f4f660a0814628c04352a6035eb3562b7d29 100644
--- a/Labgen/labgen.y
+++ b/Labgen/labgen.y
@@ -10,20 +10,36 @@ FILE * yyin;
 FILE * yyout;
 char * yytext;
 //extern char *** matrice;
-char *** matrice=NULL;
+char *** matrice = NULL;
 extern variables listevars;
+
+/* listeLAB contient les infos sur le labyrinthe */
+extern variables listLAB;
+/* listIDENT Contient la liste des IDENT (max par ex) et ses valeurs */
+extern variables listIDENT;
+/* listCOUNT compte le nombre de points pour chaque identifiant
+ * Par exemple : 1 seul point pour IN et pour SIZE, 1 ou plus pour OUT*/
+extern variables listCOUNT;
+/* listOUT contiendra toutes les sorties OUT */
+extern Point** listOUT;
+extern Point size;
+extern Point in; /*Point d'entrée du labyrinthe*/
+
 void yyerror(const char *);
 
 extern int yylineno;
 char file[255];
 
+
 %}
-%union yylval
-{
+
+
+%union {
 int cnum ;
 char* ident;
 char* op;
 char* dir;
+struct Point* point;
 }
 
 
@@ -35,6 +51,9 @@ char* dir;
 %token<cnum> OUT WALL PTD SHOW UNWALL END R F PTA FOR TOGGLE WH MD
 %token<op> OP
 %token<dir> DIR
+%type<cnum> xcst
+%type<point> pt
+
 
 
 %left  MULT DIV MOD
@@ -43,18 +62,30 @@ char* dir;
 %%
 
 file:
-listinstr
+listinstr {listLAB = init_listevars();
+           listIDENT = init_listevars();
+           listCOUNT = init_listevars(); } ;
 
-;
 listinstr:
 instruction
 |listinstr instruction
 ;
+
 instruction:
-IDENT '=' xcst END {  }
+IDENT '=' xcst END
+  { listIDENT = create_modif_var($1,$3,listIDENT); }
 |SIZE xcst END
+  { listCOUNT = increment_var("SIZE",listCOUNT);
+    listLAB = create_modif_var("SIZEc",$2,listLAB);
+    listLAB = create_modif_var("SIZEl",$2,listLAB);
+    size = new_point($2,$2); }
 |SIZE xcst ',' xcst END
+  { listCOUNT = increment_var("SIZE",listCOUNT);
+    listLAB = create_modif_var("SIZEc",$2,listLAB);
+    listLAB = create_modif_var("SIZEl",$4,listLAB);
+    size = new_point($2,$4); }
 |IN pt END
+
 |WALL END
 |TOGGLE END
 |UNWALL END
@@ -62,17 +93,12 @@ IDENT '=' xcst END {  }
 |TOGGLE R pt pt END
 |UNWALL R pt pt END
 |SHOW {
-printf("test\n");
 matrice = create_matrice(5,4);
-affichmat(matrice);
+size = new_point(5,4);
 
-point p1 = new_point(1,2);
-change_val_matrice(p1, "ABC", matrice);
-printf("%s\n", lecture(p1,matrice));
-
-change_val_matrice(p1, "DEF", matrice);
-printf("%s\n", lecture(p1,matrice));
-affichmat(matrice);
+Point p1 = new_point(1,2);
+change_val_matrice(p1, "E", matrice);
+affichmat(matrice,size);
 
 }
 
@@ -105,16 +131,16 @@ xcst
 */
 
 xcst:
-IDENT
-|CNUM
-|PLUS CNUM
-|MOINS CNUM
-| xcst PLUS xcst
-|xcst MOINS xcst
-|xcst MULT xcst
-| xcst DIV xcst
-| xcst MOD xcst
-| '(' xcst ')'  ;
+IDENT {$$ = value_var($1,listIDENT);}
+|CNUM {$$ = $1;}
+|PLUS CNUM {$$ = $2;}
+|MOINS CNUM {$$ = -$2;}
+|xcst PLUS xcst {$$ = $1 + $3;}
+|xcst MOINS xcst {$$ = $1 - $3;}
+|xcst MULT xcst {$$ = $1 * $3;}
+| xcst DIV xcst {$$ = $1 / $3;}
+| xcst MOD xcst {$$ = $1 % $3;}
+| '(' xcst ')'  {$$ = $2;} ;
 
 
 
@@ -160,7 +186,7 @@ r:
 "*"
 | xcst;
 
-pt:  '('xcst  ',' xcst')' ;
+pt:  '('xcst ',' xcst')' {$$=new_point_ptr($2,$4);};
 
 
 range:
@@ -192,6 +218,7 @@ range
 
 
 %%
+
 void yyerror(const char* mess){
     fprintf(stderr," %s:%i:syntaxe error (near %s) \n", file,yylineno,yytext);
     exit(1);
@@ -209,7 +236,7 @@ int main(int argc, char *argv[]){
             printf("Reading input from file succeded: %s\n",argv[1]);
 
             yyin = fp;
-            listevars.last = 0;
+            /*listevars.last = 0;*/
             yyparse();
         }
         else {
@@ -220,7 +247,8 @@ int main(int argc, char *argv[]){
 
 
    else if (argc == 3){
-      printf("A faire : lecture dans le fichier argc[1] + exécutable argc[2]\n");
+     listLAB = init_listevars();
+     printf("A faire : lecture dans le fichier argc[1] + exécutable argc[2]\n");
     }
 
    else{
diff --git a/Labgen/labgen_RS.c b/Labgen/labgen_RS.c
new file mode 100644
index 0000000000000000000000000000000000000000..504511b63707335bed04535e73ef35d3c68615a5
--- /dev/null
+++ b/Labgen/labgen_RS.c
@@ -0,0 +1,349 @@
+#include <math.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "labgen.h"
+
+/******************************************************************************/
+/* Règles sémantiques :
+ * Retourne 1 quand c'est correct
+ * Retourne 0 sinon */
+/******************************************************************************/
+
+/* RS1 : Le labyrinthe doit avoir au moins 2 lignes et au moins 2 colonnes */
+int RS1(Point size){
+  if (size.c >= 1 && size.l >= 1)
+    return 1;
+  printf("RS1 : Le labyrinthe doit avoir au moins 2 lignes et au moins 2 colonnes.\n");
+  return 0;
+}
+
+/* RS2_count : Le labyrinthe doit avoir une et une seule entrée */
+int RS2_count(int countE){
+  if (countE == 1)
+    return 1;
+  printf("RS2 : Le labyrinthe doit avoir une et une seule entrée.\n");
+  return 0;
+}
+
+
+/* RS3_count : Le labyrinthe doit avoir au moins une sortie */
+int RS3_count(int countS){
+  if (countS >= 1)
+    return 1;
+  printf("RS3 : Le labyrinthe doit avoir au moins une sortie.\n");
+  return 0;
+}
+
+
+
+/* RS2_3_check : L'entrée ne peut être ni une sortie ni une entrée de trou de vers
+ *               Les sorties ne peuvent être une entrée d'un trou de vers
+ * E est le point d'entrée
+ * listeS est la liste de toutes les sorties
+ * sizeS est la taille de listeS
+ * listeETV est la liste de toutes les entrées de trous de vers
+ * liste est la taille de listeETV */
+int RS2_3_check(Point E, Point* listeS, int sizeS, Point* listeETV, int sizeETV){
+  int i,j;
+  int Ec = E.c;
+  int El = E.l;
+  Point tmpS, tmpETV;
+
+  /* Vérifie que l'entrée ne correspond à aucune des entrées de trous de vers */
+  for (j=0; j<sizeETV; j++){
+    tmpETV = listeETV[j];
+    if (Ec == tmpETV.c && El == tmpETV.l)
+      return 0;
+  }
+
+  /* Vérifie que l'entrée ne correspond à aucune des sorties */
+  for (i=0; i<sizeS; i++){
+    tmpS = listeS[i];
+    if (Ec == tmpS.c && El == tmpS.l)
+      return 0;
+
+    /*Vérifie que la sortie ne correspond pas à une entrée de vers*/
+    for (j=0; j<sizeETV; j++){
+      tmpETV = listeETV[j];
+      if (tmpETV.c == tmpS.c && tmpETV.l == tmpS.l)
+        return 0;
+    }
+  }
+
+  return 1;
+}
+
+
+/* RS4 : L'entrée et les sorties du labyrinthe doivent se situer sur la périphérie
+ * du labyrinthe
+ * E est le point d'entrée
+ * S est un tableau dynamique de l'ensemble des sorties
+ * nb_S est le nombre de sorties
+ * size est un point donnant la taille du tableau */
+int RS4(Point E, Point* S, int nb_S, Point size){
+   int i;
+   Point tmp;
+   int sizec = size.c;
+   int sizel = size.l;
+
+   if (S == NULL){
+     fprintf(stderr,"RS4 : La liste des sorties est non initialisée.\n");
+     exit(1);
+   }
+
+   else if (nb_S == 0){
+     printf("RS4 : La liste des sorties est vide.\n");
+     return 0;
+   }
+
+   /* Vérification pour l'entrée */
+   else if (E.c != 0 && E.l != 0 && E.c != sizec && E.l != sizel){
+      return 0;
+   }
+
+   /* Vérification pour toutes les sorties */
+   else {
+     for (i=0 ; i<nb_S ; i++){
+       tmp = S[i];
+       if (tmp.c != 0 && tmp.l != 0 && tmp.c != sizec && tmp.l != sizel){
+          return 0;
+       }
+     }
+   }
+   return 1;
+ }
+
+
+ /* RS5 : Tant que la taille du labyrinthe n'est pas définie, il est interdit :
+  * - de définir l'entrée ou des sorties
+  * - d'utiliser des instructions de tracé
+  * - De définir des portes magiques ou des trous de vers */
+int RS5(){
+  /* A faire */
+  return 0;
+}
+
+
+/* Cette fonction est une fonction auxiliaire qui permet de vérifier si
+ * l'ensemble des points de la liste sont dans le labyrinthe.
+ * - liste est la liste de tous les points
+ * - sizeL est la longueur de la liste
+ * - sizeLAB est la taile du labyrinthe */
+int danslelaby(Point* liste, int sizeL, Point sizeLAB, char* msg){
+  int i;
+  Point tmp;
+  int sizec = sizeLAB.c;
+  int sizel = sizeLAB.l;
+
+  if (sizeL == 0){
+    printf("La liste des %s est vide.\n",msg);
+    return 1;
+    /* Vrai car le labyrinthe peut ne pas contenir d'ETV, de PM ou de murs */
+  }
+
+  for (i=0; i<sizeL; i++){
+    tmp = liste[i];
+    if (tmp.c < 0 || tmp.c > sizec || tmp.l < 0 || tmp.l > sizel)
+      return 0;
+  }
+  return 1;
+}
+
+
+/* RS6 : L'entrée et la sortie des trous de vers doivent être dans le
+ *       labyrinthe
+ * listeETV contient la liste de toutes les entrées et sorties de vers
+ * sizeETV est la longueur de listeETV
+ * sizeLAB est la taille du labyrinthe */
+int RS6(Point* listeETV, int sizeETV, Point sizeLAB){
+  return danslelaby(listeETV,sizeETV,sizeLAB,"entrées de vers");
+}
+
+
+/* RS7 : L'entrée et les sorties des portes magiques doivent être dans le
+         labyrinthe
+ * listePM est la liste des entrées et sorties des portes magiques
+ * sizePM est la longueur de listePM
+ * sizeLAB est la taille du labyrinthe */
+ int RS7(Point* listePM, int sizePM, Point sizeLAB){
+   return danslelaby(listePM,sizePM,sizeLAB,"portes magiques");
+ }
+
+
+/* RS8_PTA : Pour les tracés de murs les points définis par l'instruction
+ *           WALL PTA doivent être dans le labyrinthe
+ * listePTA est la liste de tous les murs définis par PTA
+ * sizePTA est la longueur de listePTA
+ * sizeLAB est la taille du labyrinthe */
+int RS8_PTA(Point* listePTA, int sizePTA, Point sizeLAB){
+  return danslelaby(listePTA,sizePTA,sizeLAB,"murs définis par PTA");
+}
+
+
+/* RS8_PTD : Pour les tracés de murs les points définis par l'instruction
+ *           WALL PTD doivent être dans le labyrinthe
+ * PTD est le point de départ
+ * wallptd est la liste des points donnant le déplacement
+ * wallr est la liste d'entiers, éventuellement nuls, donnant le nombre de
+ *        de déplacement pour chaque point wallptd.
+ *        On suppose que les listes wallptd et wallr ont la même taille
+ * sizeW donne la longueur de la liste wallptd
+ * sizeLAB est la taille du labyrinthe */
+int RS8_PTD(Point PTD, Point* wallptd, int sizeW, int* wallr, Point sizeLAB){
+  int sizec = sizeLAB.c;
+  int sizel = sizeLAB.l;
+  int i,j;
+  Point res;
+  Point tmpW;
+  int tmpR;
+
+  /* On vérifie que le point de départ est dans le labyrinthe */
+  if (PTD.c < 0 || PTD.c > sizec || PTD.l < 0 || PTD.l > sizel)
+    return 0;
+  /* On vérifie que le déplacement ne nous fait pas sortir du labyrinthe */
+  res = PTD;
+  for (i=0; i<sizeW; i++){
+    tmpW = wallptd[i];
+    tmpR = wallr[i];
+    res.c += tmpW.c;
+    res.l += tmpW.l;
+    if (res.c < 0 || res.c > sizec || res.l < 0 || res.l > sizel)
+      return 0;
+    if (tmpR > 1){
+      for (j=1; j<tmpR; j++){ /*On le fait bien tmpR-1 fois car on a déjà fait 1 fois avant */
+        res.c += tmpW.c;
+        res.l += tmpW.l;
+        if (res.c < 0 || res.c > sizec || res.l < 0 || res.l > sizel)
+          return 0;
+      }
+    }
+  }
+
+  return 1;
+}
+
+
+/* RS8_R : Pour les tracés de murs les points définis par l'instruction WALL R
+ *         doivent être dans le labyrinthe
+ * PTA1 est le premier point définissant le mur, PTA2 le deuxième
+ * sizeLAB est la taille du labyrinthe */
+int RS8_R(Point PTA1, Point PTA2, Point sizeLAB){
+  int sizec = sizeLAB.c;
+  int sizel = sizeLAB.l;
+
+  if (PTA1.c < 0 || PTA1.c > sizec || PTA1.l < 0 || PTA1.l > sizel)
+    return 0;
+  if (PTA2.c < 0 || PTA2.c > sizec || PTA2.l < 0 || PTA2.l > sizel)
+    return 0;
+  return 1;
+}
+
+int RS8_FOR(){
+  /* A faire */
+  return 0;
+}
+
+int RS8_1F(){
+  /* A faire */
+  return 0;
+}
+
+int RS9(){
+  /* A faire */
+  return 0;
+}
+
+int RS10(){
+  /* A faire */
+  return 0;
+}
+
+int RS11(){
+  /* A faire */
+  return 0;
+}
+
+/* Test des fonctions pour les règles sémantiques */
+int main(){
+  char*** matrice = create_matrice(5,6);
+  Point size = new_point(5,6);
+
+  Point entree1 = new_point(0,0);
+  Point entree2 = new_point(5,6);
+  Point entree3 = new_point(5,0);
+  Point entree4 = new_point(0,5);
+
+  change_val_matrice(entree1,"E",matrice);
+  change_val_matrice(entree2,"E",matrice);
+  change_val_matrice(entree3,"E",matrice);
+  change_val_matrice(entree4,"E",matrice);
+
+  Point* listeS = NULL;
+  listeS = calloc(5,sizeof(Point));
+  listeS[0] = new_point(5,5);
+  listeS[1] = new_point(3,6);
+  listeS[2] = new_point(0,0);
+  listeS[3] = new_point(0,4);
+  listeS[4] = new_point(1,6);
+
+  Point* listeETV = NULL;
+  listeETV = calloc(6,sizeof(Point));
+  listeETV[0] = new_point(2,4);
+  listeETV[1] = new_point(1,0);
+  listeETV[2] = new_point(1,1);
+  listeETV[3] = new_point(4,3);
+  listeETV[4] = new_point(5,6);
+  listeETV[5] = new_point(0,7);
+
+  Point* listePM = NULL;
+  listePM = calloc(6,sizeof(Point));
+  listePM[0] = new_point(2,4);
+  listePM[1] = new_point(1,0);
+  listePM[2] = new_point(1,1);
+  listePM[3] = new_point(4,3);
+  listePM[4] = new_point(5,6);
+  listePM[5] = new_point(0,7);
+
+  Point* wallPTD = NULL;
+  wallPTD = calloc(5,sizeof(Point));
+  wallPTD[0] = new_point(1,-1);
+  wallPTD[1] = new_point(0,1);
+  wallPTD[2] = new_point(1,0);
+  wallPTD[3] = new_point(1,1);
+  wallPTD[4] = new_point(1,0);
+
+  int* wallr = NULL;
+  wallr = calloc(5,sizeof(int));
+  wallr[0] = 0;
+  wallr[1] = 3;
+  wallr[2] = 0;
+  wallr[3] = 0;
+  wallr[4] = 2;
+
+
+  change_val_matrice(new_point(5,5),"S",matrice);
+  change_val_matrice(new_point(5,6),"S",matrice);
+  change_val_matrice(new_point(0,0),"S",matrice);
+  change_val_matrice(new_point(0,4),"S",matrice);
+  change_val_matrice(new_point(1,6),"S",matrice);
+
+  affichmat(matrice,size);
+
+  printf("Test RS2_check - entree1 : %d [0]\n", RS2_3_check(entree1,listeS,5,listeETV,5));
+  printf("Test RS2_check - entree2 : %d [0]\n", RS2_3_check(entree2,listeS,5,listeETV,5));
+  printf("Test RS2_check - entree3 : %d [1]\n", RS2_3_check(entree3,listeS,5,listeETV,5));
+  printf("Test RS2_check - entree4 : %d [1]\n", RS2_3_check(entree4,listeS,5,listeETV,5));
+  printf("Test RS4 - entree1 : %d [1]\n", RS4(entree1,listeS,5,size));
+  printf("Test RS4 - entree2 : %d [1]\n", RS4(entree2,listeS,5,size));
+  printf("Test RS4 - entree3 : %d [1]\n", RS4(entree3,listeS,5,size));
+  printf("Test RS4 - entree4 : %d [1]\n", RS4(entree4,listeS,5,size));
+  printf("Test RS6 : %d [1]\n", RS6(listeETV,5,size));
+  printf("Test RS6 : %d [0]\n", RS6(listeETV,6,size));
+  printf("Test RS7 : %d [1]\n", RS6(listePM,5,size));
+  printf("Test RS7 : %d [0]\n", RS6(listePM,6,size));
+  printf("Test RS8_PTD : %d [1]\n",RS8_PTD(new_point(0,2),wallPTD,5,wallr,size));
+
+
+  return 0;
+}
diff --git a/Labgen/labgen_varpoint.c b/Labgen/labgen_varpoint.c
new file mode 100644
index 0000000000000000000000000000000000000000..9534e93222067724be4e204d7b4d908c6b5a478a
--- /dev/null
+++ b/Labgen/labgen_varpoint.c
@@ -0,0 +1,74 @@
+#include <math.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "labgen.h"
+
+/******************************************************************************/
+/* Fonctions de base de listevarpoint                                         */
+/******************************************************************************/
+varpoint init_listevarpoint(){
+  varpoint res;
+  res.last = 0;
+  return res;
+}
+
+
+/* Vérifie si var est dans list :
+ * - si oui, renvoie l'indice correspondante
+   - sinon, renvoie -1 */
+int find_varpoint(char* var,varpoint list) {
+  int i;
+  int ret;
+
+  for (i=0; i<list.last; i++) {
+    ret = strcmp(list.ident[i], var);
+    if (ret==0) {
+    return i;
+    }
+  }
+  return -1;
+}
+
+
+/* Renvoie la valeur de l'identifiant var dans la liste list */
+Point value_varpoint(char* var,varpoint list){
+  int index = find_varpoint(var,list);
+  if (index == -1){
+    fprintf(stderr,"Aucune valeur ne correspond à %s.\n",var);
+    exit(1);
+  }
+  return *(list.val[index]);
+}
+
+
+/* Modifie la valeur de la variable :
+ * - Si "nom" fait partie de la liste des variables, alors la variable est
+ *   directement modifiée
+ * - Sinon rajoute le nom de la variable et sa valeur dans listevars
+     si la taille de listevars le permet */
+varpoint create_modif_varpoint(char* nom, Point val, varpoint list) {
+  int index = find_varpoint(nom,list);
+
+  if (index != -1)
+  {
+    *(list.val[index]) = val;
+  }
+
+  else{
+  	if (list.last > TAILLE) {
+    	printf("Il n'y a plus de place pour tous ces variables.\n");
+    	exit(1);
+  	}
+  	else{
+   	  list.ident[list.last] = malloc(strlen(nom)*sizeof(char));
+      list.val[list.last] = malloc(sizeof(Point));
+    }
+
+   	strcpy(list.ident[list.last],nom);
+   	*(list.val[list.last]) = val;
+   	list.last++;
+  }
+  return list;
+
+}
diff --git a/Labgen/test b/Labgen/test
new file mode 100644
index 0000000000000000000000000000000000000000..d0d703782462a0cc5858c106faa3764368fa6880
--- /dev/null
+++ b/Labgen/test
@@ -0,0 +1,2 @@
+SIZE 4;
+SHOW;
diff --git a/Labgen/y.tab.c b/Labgen/y.tab.c
index 68d77cdc7bf78215d295bade14bb0ddeaa76b0bb..ff53872f46b902b1fc8eff63da1a194e915f149e 100644
--- a/Labgen/y.tab.c
+++ b/Labgen/y.tab.c
@@ -74,15 +74,29 @@ FILE * yyin;
 FILE * yyout;
 char * yytext;
 //extern char *** matrice;
-char *** matrice=NULL;
+char *** matrice = NULL;
 extern variables listevars;
+
+/* listeLAB contient les infos sur le labyrinthe */
+extern variables listLAB;
+/* listIDENT Contient la liste des IDENT (max par ex) et ses valeurs */
+extern variables listIDENT;
+/* listCOUNT compte le nombre de points pour chaque identifiant
+ * Par exemple : 1 seul point pour IN et pour SIZE, 1 ou plus pour OUT*/
+extern variables listCOUNT;
+/* listOUT contiendra toutes les sorties OUT */
+extern Point** listOUT;
+extern Point size;
+extern Point in; /*Point d'entrée du labyrinthe*/
+
 void yyerror(const char *);
 
 extern int yylineno;
 char file[255];
 
 
-#line 86 "y.tab.c" /* yacc.c:339  */
+
+#line 100 "y.tab.c" /* yacc.c:339  */
 
 # ifndef YY_NULLPTR
 #  if defined __cplusplus && 201103L <= __cplusplus
@@ -173,20 +187,21 @@ extern int yydebug;
 
 /* Value type.  */
 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
-#line 21 "labgen.y" /* yacc.c:355  */
-union yylval
+
+union YYSTYPE
 {
-#line 22 "labgen.y" /* yacc.c:355  */
+#line 37 "labgen.y" /* yacc.c:355  */
 
 int cnum ;
 char* ident;
 char* op;
 char* dir;
+struct Point* point;
 
-#line 187 "y.tab.c" /* yacc.c:355  */
+#line 202 "y.tab.c" /* yacc.c:355  */
 };
-#line 21 "labgen.y" /* yacc.c:355  */
-typedef union yylval YYSTYPE;
+
+typedef union YYSTYPE YYSTYPE;
 # define YYSTYPE_IS_TRIVIAL 1
 # define YYSTYPE_IS_DECLARED 1
 #endif
@@ -200,7 +215,7 @@ int yyparse (void);
 
 /* Copy the second part of user declarations.  */
 
-#line 204 "y.tab.c" /* yacc.c:358  */
+#line 219 "y.tab.c" /* yacc.c:358  */
 
 #ifdef short
 # undef short
@@ -500,14 +515,14 @@ static const yytype_uint8 yytranslate[] =
   /* YYRLINE[YYN] -- Source line where rule number YYN was defined.  */
 static const yytype_uint8 yyrline[] =
 {
-       0,    46,    46,    50,    51,    54,    55,    56,    57,    58,
-      59,    60,    61,    62,    63,    64,    80,    81,    82,    83,
-      84,    85,    86,    87,    88,    89,    90,    91,    92,    93,
-      94,    95,   108,   109,   110,   111,   112,   113,   114,   115,
-     116,   117,   124,   125,   128,   129,   133,   134,   137,   138,
-     139,   140,   147,   148,   149,   150,   153,   154,   155,   156,
-     160,   161,   163,   167,   168,   169,   170,   173,   174,   178,
-     179,   183,   184,   187,   188
+       0,    65,    65,    70,    71,    75,    77,    82,    87,    89,
+      90,    91,    92,    93,    94,    95,   106,   107,   108,   109,
+     110,   111,   112,   113,   114,   115,   116,   117,   118,   119,
+     120,   121,   134,   135,   136,   137,   138,   139,   140,   141,
+     142,   143,   150,   151,   154,   155,   159,   160,   163,   164,
+     165,   166,   173,   174,   175,   176,   179,   180,   181,   182,
+     186,   187,   189,   193,   194,   195,   196,   199,   200,   204,
+     205,   209,   210,   213,   214
 };
 #endif
 
@@ -1393,33 +1408,120 @@ yyreduce:
   YY_REDUCE_PRINT (yyn);
   switch (yyn)
     {
-        case 5:
-#line 54 "labgen.y" /* yacc.c:1646  */
-    {  }
-#line 1400 "y.tab.c" /* yacc.c:1646  */
+        case 2:
+#line 65 "labgen.y" /* yacc.c:1646  */
+    {listLAB = init_listevars();
+           listIDENT = init_listevars();
+           listCOUNT = init_listevars(); }
+#line 1417 "y.tab.c" /* yacc.c:1646  */
+    break;
+
+  case 5:
+#line 76 "labgen.y" /* yacc.c:1646  */
+    { listIDENT = create_modif_var((yyvsp[-3].ident),(yyvsp[-1].cnum),listIDENT); }
+#line 1423 "y.tab.c" /* yacc.c:1646  */
+    break;
+
+  case 6:
+#line 78 "labgen.y" /* yacc.c:1646  */
+    { listCOUNT = increment_var("SIZE",listCOUNT);
+    listLAB = create_modif_var("SIZEc",(yyvsp[-1].cnum),listLAB);
+    listLAB = create_modif_var("SIZEl",(yyvsp[-1].cnum),listLAB);
+    size = new_point((yyvsp[-1].cnum),(yyvsp[-1].cnum)); }
+#line 1432 "y.tab.c" /* yacc.c:1646  */
+    break;
+
+  case 7:
+#line 83 "labgen.y" /* yacc.c:1646  */
+    { listCOUNT = increment_var("SIZE",listCOUNT);
+    listLAB = create_modif_var("SIZEc",(yyvsp[-3].cnum),listLAB);
+    listLAB = create_modif_var("SIZEl",(yyvsp[-1].cnum),listLAB);
+    size = new_point((yyvsp[-3].cnum),(yyvsp[-1].cnum)); }
+#line 1441 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 15:
-#line 64 "labgen.y" /* yacc.c:1646  */
+#line 95 "labgen.y" /* yacc.c:1646  */
     {
-printf("test\n");
 matrice = create_matrice(5,4);
-affichmat(matrice);
-
-point p1 = new_point(1,2);
-change_val_matrice(p1, "ABC", matrice);
-printf("%s\n", lecture(p1,matrice));
+size = new_point(5,4);
 
-change_val_matrice(p1, "DEF", matrice);
-printf("%s\n", lecture(p1,matrice));
-affichmat(matrice);
+Point p1 = new_point(1,2);
+change_val_matrice(p1, "E", matrice);
+affichmat(matrice,size);
 
 }
-#line 1419 "y.tab.c" /* yacc.c:1646  */
+#line 1455 "y.tab.c" /* yacc.c:1646  */
     break;
 
+  case 32:
+#line 134 "labgen.y" /* yacc.c:1646  */
+    {(yyval.cnum) = value_var((yyvsp[0].ident),listIDENT);}
+#line 1461 "y.tab.c" /* yacc.c:1646  */
+    break;
 
-#line 1423 "y.tab.c" /* yacc.c:1646  */
+  case 33:
+#line 135 "labgen.y" /* yacc.c:1646  */
+    {(yyval.cnum) = (yyvsp[0].cnum);}
+#line 1467 "y.tab.c" /* yacc.c:1646  */
+    break;
+
+  case 34:
+#line 136 "labgen.y" /* yacc.c:1646  */
+    {(yyval.cnum) = (yyvsp[0].cnum);}
+#line 1473 "y.tab.c" /* yacc.c:1646  */
+    break;
+
+  case 35:
+#line 137 "labgen.y" /* yacc.c:1646  */
+    {(yyval.cnum) = -(yyvsp[0].cnum);}
+#line 1479 "y.tab.c" /* yacc.c:1646  */
+    break;
+
+  case 36:
+#line 138 "labgen.y" /* yacc.c:1646  */
+    {(yyval.cnum) = (yyvsp[-2].cnum) + (yyvsp[0].cnum);}
+#line 1485 "y.tab.c" /* yacc.c:1646  */
+    break;
+
+  case 37:
+#line 139 "labgen.y" /* yacc.c:1646  */
+    {(yyval.cnum) = (yyvsp[-2].cnum) - (yyvsp[0].cnum);}
+#line 1491 "y.tab.c" /* yacc.c:1646  */
+    break;
+
+  case 38:
+#line 140 "labgen.y" /* yacc.c:1646  */
+    {(yyval.cnum) = (yyvsp[-2].cnum) * (yyvsp[0].cnum);}
+#line 1497 "y.tab.c" /* yacc.c:1646  */
+    break;
+
+  case 39:
+#line 141 "labgen.y" /* yacc.c:1646  */
+    {(yyval.cnum) = (yyvsp[-2].cnum) / (yyvsp[0].cnum);}
+#line 1503 "y.tab.c" /* yacc.c:1646  */
+    break;
+
+  case 40:
+#line 142 "labgen.y" /* yacc.c:1646  */
+    {(yyval.cnum) = (yyvsp[-2].cnum) % (yyvsp[0].cnum);}
+#line 1509 "y.tab.c" /* yacc.c:1646  */
+    break;
+
+  case 41:
+#line 143 "labgen.y" /* yacc.c:1646  */
+    {(yyval.cnum) = (yyvsp[-1].cnum);}
+#line 1515 "y.tab.c" /* yacc.c:1646  */
+    break;
+
+  case 62:
+#line 189 "labgen.y" /* yacc.c:1646  */
+    {(yyval.point)=new_point_ptr((yyvsp[-3].cnum),(yyvsp[-1].cnum));}
+#line 1521 "y.tab.c" /* yacc.c:1646  */
+    break;
+
+
+#line 1525 "y.tab.c" /* yacc.c:1646  */
       default: break;
     }
   /* User semantic actions sometimes alter yychar, and that requires
@@ -1647,7 +1749,8 @@ yyreturn:
 #endif
   return yyresult;
 }
-#line 194 "labgen.y" /* yacc.c:1906  */
+#line 220 "labgen.y" /* yacc.c:1906  */
+
 
 void yyerror(const char* mess){
     fprintf(stderr," %s:%i:syntaxe error (near %s) \n", file,yylineno,yytext);
@@ -1666,7 +1769,7 @@ int main(int argc, char *argv[]){
             printf("Reading input from file succeded: %s\n",argv[1]);
 
             yyin = fp;
-            listevars.last=0;
+            /*listevars.last = 0;*/
             yyparse();
         }
         else {
@@ -1677,7 +1780,8 @@ int main(int argc, char *argv[]){
 
 
    else if (argc == 3){
-      printf("A faire : lecture dans le fichier argc[1] + exécutable argc[2]\n");
+     listLAB = init_listevars();
+     printf("A faire : lecture dans le fichier argc[1] + exécutable argc[2]\n");
     }
 
    else{
diff --git a/Labgen/y.tab.h b/Labgen/y.tab.h
index f28a28205254b5736cc3b43e84c320fe7e1ef990..d27ac00907eac2c6bc93fa9c93d5f67860843526 100644
--- a/Labgen/y.tab.h
+++ b/Labgen/y.tab.h
@@ -101,20 +101,21 @@ extern int yydebug;
 
 /* Value type.  */
 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
-#line 21 "labgen.y" /* yacc.c:1909  */
-union yylval
+
+union YYSTYPE
 {
-#line 22 "labgen.y" /* yacc.c:1909  */
+#line 37 "labgen.y" /* yacc.c:1909  */
 
 int cnum ;
 char* ident;
 char* op;
 char* dir;
+struct Point* point;
 
-#line 115 "y.tab.h" /* yacc.c:1909  */
+#line 116 "y.tab.h" /* yacc.c:1909  */
 };
-#line 21 "labgen.y" /* yacc.c:1909  */
-typedef union yylval YYSTYPE;
+
+typedef union YYSTYPE YYSTYPE;
 # define YYSTYPE_IS_TRIVIAL 1
 # define YYSTYPE_IS_DECLARED 1
 #endif
diff --git a/a.out b/a.out
new file mode 100755
index 0000000000000000000000000000000000000000..53421a5a8971839aafa1be1bb57b6fb3d2ea8f74
Binary files /dev/null and b/a.out differ