#include "delta_encrier.h"

/* table des lexemes */
extern ECHANT *Techant;
extern long nb_echant;

/* table des types de variables */
extern TYPE_VARIABLE tab_type_variable[MAX_TYPE_VARIABLE];
extern int nb_tab_type_variable;


/* table des instructions */
extern INSTRUCTION tab_instruction[MAX_INSTRUCTION];
extern int nb_instruction;

/* table des fonctions */
extern FONCTION tab_fonction[MAX_FONCTION];
extern int nb_fonction;

extern char tab_fonctions_appelees[MAX_FONCTION][MAX_IDENT];
extern int nb_fonctions_appellees;

/* table des routines */
extern SUBROUTINE tab_subroutine[MAX_SUBROUTINE];
extern int nb_subroutine;

/* table des taches */
extern TACHE tab_tache[MAX_TACHE];
extern int nb_tache;

/* table des mutex */
extern TAB_MUTEX tab_mutex[MAX_MUTEX];
extern int nb_mutex;

/* programme */
extern PROGRAM program;

extern char nom_fic[100];
extern long limite;
extern FILE *file_conf;

extern char buffer_courant[1000];
extern long ligne_lu;
extern long limite;

extern int  ignore_chaine;
extern char chaine_ignoree[300];

extern int   index_lexeme;
extern int   type_token;
extern char  token[MAX_IDENT];
extern int   ligne_courante;
extern int   cr;
#include "delta_encrier.h"

/* table des lexemes */
extern ECHANT *Techant;
extern long nb_echant;

/* table des types de variables */
extern TYPE_VARIABLE tab_type_variable[MAX_TYPE_VARIABLE];
extern int nb_tab_type_variable;


/* table des instructions */
extern INSTRUCTION tab_instruction[MAX_INSTRUCTION];
extern int nb_instruction;

/* table des fonctions */
extern FONCTION tab_fonction[MAX_FONCTION];
extern int nb_fonction;

/* table des routines */
extern SUBROUTINE tab_subroutine[MAX_SUBROUTINE];
extern int nb_subroutine;

/* table des taches */
extern TACHE tab_tache[MAX_TACHE];
extern int nb_tache;

/* programme */
extern PROGRAM program;

extern char nom_fic[100];
extern long limite;
extern FILE *file_conf;

extern char buffer_courant[1000];
extern long ligne_lu;
extern long limite;

extern int  ignore_chaine;
extern char chaine_ignoree[300];

extern int   index_lexeme;
extern int   type_token;
extern char  token[MAX_IDENT];
extern char  module[100];
extern int   ligne_courante;
extern int   cr;


int recherche_type(char *);

int boucle; /* compteur de boucle */
int flag_return; /* flag fonction */

extern int traceaff;



 /* lit un token */
extern int lire_token();
/* repositionne au token precedent */
extern int retour_arriere();
/* analyse lexicale */
extern void analyse_lexicale(char *);


/* message d'erreur */

void message_erreur(char *message)
  {
	  	printf("\n -------> module %s line %d :: \n[%s] token = %s",module,ligne_courante,message,token);
		printf("\n\n\n Press a key to terminate");
			for(;kbhit()==0;){}
		exit(-1);
   }


void message_erreur_warning(char *message)
  {
	  	printf("\n -------> module %s line %d :: \n[%s] token = %s",module,ligne_courante,message,token);
   }


/* ajout d'une variable */

void ajout_variable(char *prof_bloc,
					int index_type,
					char *type,
					char *ident,
					char *valeur,
					int init_var,
					int type_pointeur)
   {
	   int i;


	   /* prendre en compte la profondeur */

	   for(i=0;i<program.nb_vg;i++)
		   {
			    if(strcmp(program.vg[i].bloc,prof_bloc)!=0) continue; /* ca n'est pas le même niveau de variables */
		   		if(strcmp(program.vg[i].ident,ident)==0) break; /* c'est une double declaration */
		   }

	   if(i<program.nb_vg)
		   {
			    if(traceaff==1) printf("\n %s %s %s",program.vg[i].bloc,program.vg[i].ident,ident);
		   		/*message_erreur(" Fatale #S0001 :: double déclaration de variable ");*/
				message_erreur(SX0001);
			}

	   if(index_type==-1) /* ça n'est pas un tableau */
   		{
	   		for(i=0;i<nb_tab_type_variable;i++)
				{
		   			if(strcmp(tab_type_variable[i].type,type)==0)
						/*{
							if(tab_type_variable[i].genre_variable!=TABLEAU) */break;
						/*}*/
			    }
	   		if(i==nb_tab_type_variable)
		   		message_erreur(SX0010);
		}
		else i=index_type; /* c'est un tableau, l'index est celui retourné dans sa création */

		/*printf("\n ajout %s %d %s %d",ident,i,tab_type_variable[i].type,program.nb_vg); */

		program.vg[program.nb_vg].type_variable_ptr=(TYPE_VARIABLE *)&tab_type_variable[i];

		if(traceaff==1) printf("\n %s [%d] ajout ident = %s index_type = %d type = %s %s",prof_bloc,program.nb_vg,ident,i,tab_type_variable[i].type,type);
		if(type_pointeur==POINTEUR)
			{
				if(traceaff==1) printf(" POINTEUR ");
		    }
		if(type_pointeur==POINTEURPOINTEUR)
			{
				if(traceaff==1) printf(" POINTEUR de POINTEUR");
			}

		strcpy(program.vg[program.nb_vg].ident,ident);
		strcpy(program.vg[program.nb_vg].bloc,prof_bloc);
		program.vg[program.nb_vg].type_pointeur=type_pointeur;

		if(init_var==-1)
			program.vg[program.nb_vg].modify=1;
		else
			program.vg[program.nb_vg].modify=0;

		if(init_var==1)
			{
				strcpy(program.vg[program.nb_vg].valeur,valeur);
				program.vg[program.nb_vg].modify=0;
			}
		else
			{
				strcpy(program.vg[program.nb_vg].valeur,"");
				if(init_var!=-1) program.vg[program.nb_vg].modify=0;
			}

		program.nb_vg++;
  }

 /* ajout d'un type qui peut être un tableau ou une structure */

int ajout_type(char *prof_bloc,
			   char *type,
			   int  genre,
			   int  *dimension,
			   int  nb_dimension,
			   char *structure,
			   char *champ_structure,
			   int  index_champ,
			   int  type_pointeur)
  {
	  	int i,j;

		switch(genre)
			{
				case TABLEAU :
				 {
					strcpy(tab_type_variable[nb_tab_type_variable].type,type);
	  				tab_type_variable[nb_tab_type_variable].genre_variable=genre;
	    			tab_type_variable[nb_tab_type_variable].nb_dimension=nb_dimension;
					strcpy(tab_type_variable[nb_tab_type_variable].bloc,prof_bloc);

					for(i=0;i<nb_dimension;i++)
						tab_type_variable[nb_tab_type_variable].dimension[i]=dimension[i];

					if(traceaff==1) printf("\n Ajout type TABLEAU %s dimension %d  ",type,nb_dimension);

					for(i=0;i<nb_dimension;i++)
						if(traceaff==1) printf("[%d]",dimension[i]);

					return(nb_tab_type_variable++); /* l'index du type tableau est retourné */
			    }break;
			   case STRUCTURE :
				  {
					  	if(traceaff==1) printf("\n AJOUT CHAMP S=%s C=%s T=%s D=%d",structure,champ_structure,type,nb_dimension);
						if(type_pointeur==POINTEUR)
						   {
							   if(traceaff==1) printf(" POINTEUR ");
						   }
						if(type_pointeur==POINTEURPOINTEUR)
						   {
									if(traceaff==1) printf(" POINTEUR de POINTEUR");
						   }

						if(index_champ==0) /* il faut creer la structure */
							{
									/* recherche de la structure */
								for(i=0;i<nb_tab_type_variable;i++)
									if(strcmp(structure,tab_type_variable[i].type)==0)
										break;
								if(i!=nb_tab_type_variable)
										message_erreur(SX0020);

								strcpy(tab_type_variable[nb_tab_type_variable].type,structure);
	  							tab_type_variable[nb_tab_type_variable].genre_variable=STRUCTURE;
								strcpy(tab_type_variable[nb_tab_type_variable].bloc,prof_bloc);
	    						tab_type_variable[nb_tab_type_variable].nb_champ=0;
								tab_type_variable[nb_tab_type_variable].nb_dimension=0; /* ajout */
								nb_tab_type_variable++;
							}

							/* recherche de la structure */
							/* ajout d'un noveau champ */

							for(i=0;i<nb_tab_type_variable;i++)
									if(strcmp(structure,tab_type_variable[i].type)==0)
										break;

							if(i==nb_tab_type_variable)
									message_erreur(SX0030);

							/* controle de double declaration de champ */
							for(j=0;j<tab_type_variable[i].nb_champ;j++)
								{
									/*printf("\n compare %s %d %s ",tab_type_variable[i].type_variable_ptr[j]->type,j,type);*/
									if(strcmp(tab_type_variable[i].type_variable_ptr[j]->champ_structure,champ_structure)==0)
										message_erreur(SX0040);
								}

							strcpy(tab_type_variable[nb_tab_type_variable].type,type);
							strcpy(tab_type_variable[nb_tab_type_variable].champ_structure,champ_structure);
	  						tab_type_variable[nb_tab_type_variable].genre_variable=CHAMP;
							tab_type_variable[nb_tab_type_variable].nb_dimension=nb_dimension;
							for(j=0;j<nb_dimension;j++)
								tab_type_variable[nb_tab_type_variable].dimension[j]=dimension[j];
							strcpy(tab_type_variable[nb_tab_type_variable].bloc,prof_bloc);
							tab_type_variable[nb_tab_type_variable].type_pointeur=type_pointeur;

							/* on raccroche le champ à la strcuture */

							tab_type_variable[i].type_variable_ptr[tab_type_variable[i].nb_champ]=(TYPE_VARIABLE*)&tab_type_variable[nb_tab_type_variable];
	    					tab_type_variable[i].nb_champ++;
							nb_tab_type_variable++;
				  }break;
	    	}
		return(0);
  }

/* fonction d'initialisation des types */
void init_type_variable(char *prof_bloc)
 {
		int i,j;

		/* initialise les types de variables  */

		for(i=0;i<MAX_TYPE_VARIABLE;i++)
			{
					for(j=0;j<10;j++)
							tab_type_variable[i].type_variable_ptr[j]=NULL;

					tab_type_variable[i].nb_type_variable=0;
					tab_type_variable[i].nb_dimension=0;
			}

		tab_type_variable[0].genre_variable=ATOME;
		tab_type_variable[0].nb_champ=0;
		tab_type_variable[0].nb_dimension=0;
		tab_type_variable[0].type_pointeur=PASPOINTEUR;
		strcpy(tab_type_variable[0].type,"int");
		strcpy(tab_type_variable[0].bloc,prof_bloc);

		tab_type_variable[1].genre_variable=ATOME;
		tab_type_variable[1].nb_champ=0;
		tab_type_variable[1].nb_dimension=0;
		tab_type_variable[0].type_pointeur=PASPOINTEUR;
		strcpy(tab_type_variable[1].type,"float");
		strcpy(tab_type_variable[1].bloc,prof_bloc);

		tab_type_variable[2].genre_variable=ATOME;
		tab_type_variable[2].nb_champ=0;
		tab_type_variable[2].nb_dimension=0;
		tab_type_variable[2].type_pointeur=PASPOINTEUR;
		strcpy(tab_type_variable[2].type,"char");
		strcpy(tab_type_variable[2].bloc,prof_bloc);

		tab_type_variable[3].genre_variable=ATOME;
		tab_type_variable[3].nb_champ=0;
		tab_type_variable[3].nb_dimension=0;
		tab_type_variable[3].type_pointeur=PASPOINTEUR;
		strcpy(tab_type_variable[3].type,"byte");
		strcpy(tab_type_variable[3].bloc,prof_bloc);

		/****/
		tab_type_variable[4].genre_variable=ATOME;
		tab_type_variable[4].nb_champ=0;
		tab_type_variable[4].nb_dimension=0;
		tab_type_variable[4].type_pointeur=PASPOINTEUR;
		strcpy(tab_type_variable[4].type,"schar");
		strcpy(tab_type_variable[4].bloc,prof_bloc);

		tab_type_variable[5].genre_variable=ATOME;
		tab_type_variable[5].nb_champ=0;
		tab_type_variable[5].nb_dimension=0;
		tab_type_variable[5].type_pointeur=PASPOINTEUR;
		strcpy(tab_type_variable[5].type,"sint");
		strcpy(tab_type_variable[5].bloc,prof_bloc);

		tab_type_variable[6].genre_variable=ATOME;
		tab_type_variable[6].nb_champ=0;
		tab_type_variable[6].nb_dimension=0;
		tab_type_variable[6].type_pointeur=PASPOINTEUR;
		strcpy(tab_type_variable[6].type,"long");
		strcpy(tab_type_variable[6].bloc,prof_bloc);

		tab_type_variable[7].genre_variable=ATOME;
		tab_type_variable[7].nb_champ=0;
		tab_type_variable[7].nb_dimension=0;
		tab_type_variable[7].type_pointeur=PASPOINTEUR;
		strcpy(tab_type_variable[7].type,"slong");
		strcpy(tab_type_variable[7].bloc,prof_bloc);

		/***/

		tab_type_variable[8].genre_variable=ATOME;
		tab_type_variable[8].nb_champ=0;
		tab_type_variable[8].nb_dimension=0;
		tab_type_variable[8].type_pointeur=PASPOINTEUR;
		strcpy(tab_type_variable[8].type,"void");
		strcpy(tab_type_variable[8].bloc,prof_bloc);

		tab_type_variable[9].genre_variable=ATOME;
		tab_type_variable[9].nb_champ=0;
		tab_type_variable[9].nb_dimension=1;
		tab_type_variable[9].type_pointeur=PASPOINTEUR;
		strcpy(tab_type_variable[9].type,"chaine_system_tab");
		strcpy(tab_type_variable[9].bloc,prof_bloc);

		tab_type_variable[10].genre_variable=ATOME;
		tab_type_variable[10].nb_champ=0;
		tab_type_variable[10].nb_dimension=0;
		tab_type_variable[10].type_pointeur=POINTEUR;
		strcpy(tab_type_variable[10].type,"chaine_systeme_ptr");
		strcpy(tab_type_variable[10].bloc,prof_bloc);

		nb_tab_type_variable=11;

		if(traceaff==1) printf("\n fin initialisation variable globale ");

 }

 /* detecte si une fonction est declaree */

int detecte_fonction(void)
 {

	 		/* on verifie si ça n'est pas une fonction */

			if(type_token==LOP)
				{
					if(traceaff==1) printf("\n fonction rertournant un pointeur de structure detectee ");
					return(0);
				}

			/* on verifie si ça n'est pas une fonction */

			if( (type_token==LIDENT)   ||
				(type_token==LENTIER)  ||
			    (type_token==LCHAR)    ||
				(type_token==LSCHAR)   ||
				(type_token==LSINT)    ||
				(type_token==LLONG)    ||
				(type_token==LSLONG)   ||
			    (type_token==OCTET)    ||
				(type_token==LFLOTTANT)||
			    (type_token==LVOID))
			   {
				   if(traceaff==1) printf("\n tentative de detection defonction");
				   /* c'est une fonction */
				   if(type_token==LVOID)
					{
				        if(traceaff==1) printf("\n Fonction type VOID detecte ");
				   		return(0);
					}

				   if(type_token==LIDENT)
					   {
				   			cr=lire_token();
				   			if(cr==-1)
								message_erreur(SX0050);
							if(type_token==LOP)
								{
									/* on se repostionne sur le token LIDENT nom de la fonction */
									cr=retour_arriere();
									cr=retour_arriere();
									cr=lire_token();
									if(cr==-1)
										message_erreur(SX0060);
									if(traceaff==1) printf("\n Fonction sans type detecte ");
									return(0);
								}
							/* onse positionne sur le token LIDENT qui est un type structure */
							cr=retour_arriere();
							cr=retour_arriere();
							cr=lire_token();
							if(cr==-1)
								message_erreur(SX0070);
					  }
					else /* c'est un type LENTIER ou LCHAR ou LBYTE ou LFLOTTANT */
					  {
							cr=lire_token();
				   			if(cr==-1)
								message_erreur(SX0080);

							if(traceaff==1) printf("\n token = %s %d",token,type_token);

							if((type_token!=LIDENT)&&(type_token!=LMUL))
								{
									message_erreur(SX0090);
								}

							if(type_token==LIDENT)
							 {
								 	cr=lire_token();
				   					if(cr==-1)
										message_erreur(SX0100);

									if(traceaff==1) printf("\n TOKEN =%s",token);/* sleep(2000);*/

									if(type_token==LOP)
										{
											/* on se repostionne sur le token LIDENT nom de la fonction */
											cr=retour_arriere();
											cr=retour_arriere();
											cr=retour_arriere();
											cr=lire_token();
											if(cr==-1)
												message_erreur(SX0110);
											if(traceaff==1) printf("\n Fonction retournant un atome detecte");
											return(0);
										}
									/* on se positionne sur le token type ça n'est pas une fonction */
									cr=retour_arriere();
									cr=retour_arriere();
									cr=retour_arriere();
									cr=lire_token();

									if(cr==-1)
										message_erreur(SX0120);
									if(traceaff==1) printf("\n Ce n'est pas une fonction mais une declaration atome var %s",token);
							 }
							else /* c'est un pointeur */
							 {
								 	/* on se positionne sur le token type ça n'est pas une fonction */
									cr=retour_arriere();
									cr=retour_arriere();
									cr=lire_token();
									if(cr==-1)
										message_erreur(SX0130);
									if(traceaff==1) printf("\n ça n'est pas une fonction");
							 }
					  }
			   } /* fin de dection des fonctions */

			   return(-1);
 }


/* fonction de recherche de type yc si c'est un tableau */
int recherche_type_bis(char *type)
 {
	 int i;

	 for(i=0;i<nb_tab_type_variable;i++)
		if(((tab_type_variable[i].genre_variable==ATOME)||
		    (tab_type_variable[i].genre_variable==STRUCTURE)/*||
			/*(tab_type_variable[i].genre_variable==TABLEAU)*/) &&
	   		(strcmp(type,tab_type_variable[i].type)==0)) break;


	if(i==nb_tab_type_variable)
	 	return(-1);
	else
		return(i);
 }

/* fonction d'analyse des variables */

void analyse_variable(char *prof_bloc)
  {
		int i,j;

		for(;;)
		 {
			cr=lire_token();
			if(cr==-1)
					message_erreur(SX0140);

			/* on est dans un corps de fonction ou tache ou subroutine, inutile de faire ces tests */
			if(strcmp(prof_bloc,"0")==0)
			  {
				/* on sort car on detecte une tâche */
				if(type_token==LTASK)
					{
						if(traceaff==1) printf("\n tache detectee");
						break;
					}
				if(type_token==LSUBROUTINE)
					{
						if(traceaff==1) printf("\n subroutine detectee");
						break;
					}
				if(type_token==LMUTEX)
					{
						if(traceaff==1) printf("\n mutex detecte");
						break;
					}

				/* on verifie si ça n'est pas une fonction */

				if(detecte_fonction()!=-1) break;

				if(traceaff==1) printf("\n token = %s %d %d",token,ligne_courante,type_token);
			 }

			if(strcmp(prof_bloc,"0")!=0) /* cas des variables locales */
				{
					 int index_type;

					 if(type_token==LIDENT) /* si ce n'est pas un type c'est un ident de variable ou de goto */
				 		{
							index_type=recherche_type_bis(token);
						    if(index_type==-1)
							   {
								   if(traceaff==1) printf("\n Il y a un identifiant qui n'est pas un type structure => fin des variables globales ");
								  /* retour_arriere();
								   cr=lire_token();
								   if(cr==-1)
										message_erreur("\n Erreur Fatale : fin prématuré du fichier source dans le corps ");*/

								   break;
							   }
							 if(traceaff==1) printf("\n le type %s existe",token);
					    }
					 else
					 if( (type_token!=LSTRUCT)&&
						 (type_token!=LENTIER)&&
						 (type_token!=LCHAR)&&
						 (type_token!=LSCHAR)&&
						 (type_token!=LSINT)&&
						 (type_token!=LLONG)&&
						 (type_token!=LSLONG)&&
						 (type_token!=LFLOTTANT)&&
						 (type_token!=OCTET))
						 {
							 /* retour_arriere();
							  cr=lire_token();
						      if(cr==-1)
								 message_erreur("\n Erreur Fatale : fin prématuré du fichier source dans le corps ");*/
					 		break; /* ca n'est pas une declaration */
						 }
			    }

			switch(type_token)
			  {
				/* déclaration de tableau d'atomes ou de variables simples d'atomes */
			  	case LENTIER:
				case LFLOTTANT:
				case LCHAR:
				case LSCHAR:
				case LSINT:
				case LLONG:
				case LSLONG:
				case OCTET:
				case LIDENT:
					{
						char type[MAX_IDENT];
						char ident[MAX_IDENT];
						char entier[MAX_IDENT];
						int  index_type;
						int  dimension[MAX_DIMENSION];
						int  nb_dimension=0;
						int  init_var;
						int  type_pointeur;
						char valeur_token[1000];

						strcpy(type,token);

						init_var=0;

						for(;;)
							{
								cr=lire_token();
								if(cr==-1)
									message_erreur(SX0150);

								if((type_token!=LIDENT)&&(type_token!=LMUL))
									message_erreur(SX0160);

								/*printf("\n W->>>>>>>>>>>>>>>>>ajout variable %s",type);*/
								/* detection de pointeur int *a */
								if((type_token==LMUL))
									{
											type_pointeur=POINTEUR;

											cr=lire_token();
											if(cr==-1)
												message_erreur(SX0170);

											if((type_token!=LIDENT)&&(type_token!=LMUL))
												message_erreur(SX0180);

											if((type_token==LMUL))
												{

													type_pointeur=POINTEURPOINTEUR;
													cr=lire_token();
													if(cr==-1)
														message_erreur(SX0190);
												}

											if((type_token!=LIDENT))
												message_erreur(SX0200);
									}
								else type_pointeur=PASPOINTEUR;

								strcpy(ident,token);
								/*printf("\n X->>>>>>>>>>>>>>>>>ajout variable %s %s ",type,ident);*/

								cr=lire_token();
								if(cr==-1)
									message_erreur(SX0210);

								if((type_token!=LPV)&&(type_token!=LV)&&(type_token!=LCROP)&&(type_token!=LEG))
									message_erreur(SX0220);

								index_type=-1;  /* à priori pas un tableau */

								nb_dimension=0;

								for(;;) /* parsing des dimensions du tableau */
									{

										if(type_token==LCROP)
								 		 {
										  	cr=lire_token();
											if(cr==-1)
												message_erreur(SX0230);

											strcpy(entier,token);

											/*printf("\n TABLEAU %d \n",atoi(entier));*/

											dimension[nb_dimension++]=atoi(entier);
											if(nb_dimension>MAX_DIMENSION)
												{
														message_erreur(SX0240);
												}

											cr=lire_token();
											if(cr==-1)
												message_erreur(SX0250);

											if(type_token!=LCRCL)
												message_erreur(SX0260);

											cr=lire_token();

										} else break;
								  }

								if(nb_dimension>0)
									index_type=ajout_type(prof_bloc,type,TABLEAU,dimension,nb_dimension,NULL,NULL,0,type_pointeur);

								/*printf("\n Y->>>>>>>>>>>>>>>>>ajout variable %s %s ",type,ident);*/

								/* il s'agit d'une initialisation de variable */
								if(type_token==LEG)
									{
											int signe;

											signe=0;

											cr=lire_token();
											if(cr==-1)
												message_erreur(SX0270);

											if(type_token==LMOINS) /* signe - */
												{
													signe=1;

													cr=lire_token();
													if(cr==-1)
														message_erreur(SX0280);

												}

											if((type_token!=LCHIFFREENT)&&(type_token!=LCHIFFRREEL)&&(type_token!=CHAINE))
												message_erreur(SX0290);

											strcpy(valeur_token,token);

											switch(type_token)
												{
														case LCHIFFREENT:
															{
																long valeur;
																long valabs;

																if( (strcmp(type,"int")!=0)&&
																	(strcmp(type,"byte")!=0)&&
																	(strcmp(type,"char")!=0)&&
																	(strcmp(type,"long")!=0)&&
																	(strcmp(type,"sint")!=0)&&
																	(strcmp(type,"sbyte")!=0)&&
																	(strcmp(type,"schar")!=0)&&
																	(strcmp(type,"slong")!=0)
																  )
																	{
																		message_erreur(SX0300);
																	}

																if((token[0]=='0')&&(token[1]=='x'))
																	{
																		sscanf(token,"%xd",&valeur);
																		if(traceaff==1) printf("\n hexadecimal = %d",valeur);
																	}
																if((token[0]=='0')&&(token[1]=='b'))
																	{
																		sscanf(token,"%bd",&valeur);
																		if(traceaff==1) printf("\n binaire = %d",valeur);
																	}
																else
																	valabs=valeur=atoi(token);

																if( (strcmp(type,"sbyte")!=0)&&
																	(strcmp(type,"schar")!=0)&&
																	(strcmp(type,"sint")!=0)&&
																	(strcmp(type,"slong")!=0)&&
																	(signe==1))
																	{
																		message_erreur(SX0310);
																	}

																if(signe==1)
																	{
																			valeur=-valeur;
																			sprintf(valeur_token,"-%s",token);
																	}
/* contrôle à améliorer */
																/* 8 bits non signé */
																if((valabs>255)&&((strcmp(type,"char")==0)||(strcmp(type,"byte")==0)))
																	{
																		message_erreur(SX0320);
																	}
																/* 8 bits  signé */
																if((valabs>128)&&((strcmp(type,"schar")==0)||(strcmp(type,"sbyte")==0)))
																	{
																		message_erreur(SX0330);
																	}
																/* 16 bits non signé */
																if((valabs>65535)&&(strcmp(type,"int")==0))
																	{
																		message_erreur(SX0340);
																	}
																/* 16 bits  signé */
																if((valabs>32767)&&(strcmp(type,"sint")==0))
																	{
																		message_erreur(SX0350);
																	}
																/* 32 bits non signé */
																if((valabs>4294967296)&&(strcmp(type,"long")==0))
																	{
																		message_erreur(SX0360);
																	}
																/* 32 bits  signé */
																if((valabs>2147483647)&&(strcmp(type,"slong")==0))
																	{
																		message_erreur(SX0370);
																	}

																init_var=1;
															}break;
														case LCHIFFRREEL:
															{
																if( (strcmp(type,"float")!=0))
																	{
																		message_erreur(SX0380);
																	}
																init_var=1;
															}break;
														case CHAINE:
															{
																if(strcmp(type,"char")!=0)
																	{
																		message_erreur(SX0390);
																	}
																if(nb_dimension!=1)
																	{
																		message_erreur(SX0400);
																	}
																if(traceaff==1) printf("\n D=%d LV=%d",dimension[0]-1,(strlen(token)));
																if((dimension[0]-1)<(strlen(token)-2))
																	{
																		message_erreur(SX0410);
																	}
																init_var=1;
															}break;
												}
											if(traceaff==1) printf("\n initialisation type = %s valeur = %s",type,token);
											cr=lire_token();
											if(cr==-1)
												message_erreur(SX0420);
									}

								/*printf("\n Z->>>>>>>>>>>>>>>>>ajout variable %s %s ",type,ident);*/

								if(init_var==0)
									ajout_variable(prof_bloc,index_type,type,ident,NULL,init_var,type_pointeur);
								else
									ajout_variable(prof_bloc,index_type,type,ident,valeur_token,init_var,type_pointeur);

								if(traceaff==1) printf("\n fin ajout variable ");

								if(type_token==LPV) break;

								if(type_token!=LV)
									message_erreur(SX0430);
							} /* for des varaibles de meme type */



					}break;
				case LSTRUCT : /* déclaration de structures */
					{
						int  nb_champ;
						char champ[MAX_IDENT];
						char nom_structure[MAX_IDENT];

						nb_champ=0;

						cr=lire_token();

						/*sleep(1000);*/

						if(cr==-1)
							message_erreur(SX0440);

						if(type_token!=LIDENT)
								message_erreur(SX0450);

						strcpy(nom_structure,token);

						if(traceaff==1) printf("\n STRUCTURE = %s\n",nom_structure);

						cr=lire_token();
						if(cr==-1)
							message_erreur(SX0460);

						if(type_token!=LBEGIN)
								message_erreur(SX0470);

						for(;;) /* analyse de tous les champs */
						 {
							 if(nb_champ==MAX_CHAMP)
								 message_erreur(SX0480);

							 cr=lire_token();
							 if(cr==-1)
									message_erreur(SX0490);

							 if(type_token==LEND)
									{
										if(traceaff==1) printf("\n fin de structure %d",nb_champ);
										break;
									}

							 switch(type_token)
			  					{
									/* déclaration de tableau d'atomes ou de variables simples d'atomes */
			  						case LENTIER:
									case LFLOTTANT:
									case LCHAR:
									case LSCHAR:
									case LSINT:
									case LLONG:
									case LSLONG:
									case OCTET:
									case LIDENT:
										{
											char type[MAX_IDENT];
											char ident[MAX_IDENT];
											char entier[MAX_IDENT];
											int  index_type;
											int  dimension[MAX_DIMENSION];
											int  nb_dimension=0;
											int  type_pointeur;

											strcpy(type,token);
											if(traceaff==1) printf("\n     struct  token = %s",token);


											for(;;) /* variable de même type */
												{

													cr=lire_token();
													if(cr==-1)
														message_erreur(SX0500);

													if((type_token!=LIDENT)&&(type_token!=LMUL))
														message_erreur(SX0510);

													/* detection de pointeur int *a */
													if((type_token==LMUL))
														{
															type_pointeur=POINTEUR;

															cr=lire_token();
															if(cr==-1)
																message_erreur(SX0520);

															if((type_token!=LIDENT)&&(type_token!=LMUL))
																message_erreur(SX0530);

															if((type_token==LMUL))
																{

																	type_pointeur=POINTEURPOINTEUR;
																	cr=lire_token();
																	if(cr==-1)
																	message_erreur(SX0540);
																}

															if((type_token!=LIDENT))
																	message_erreur(SX0550);
														}
													else type_pointeur=PASPOINTEUR;

													strcpy(ident,token);
													if(traceaff==1) printf("\n     struct champ token = %s",token);

													cr=lire_token();
													if(cr==-1)
														message_erreur(SX0560);

													if((type_token!=LPV)&&(type_token!=LV)&&(type_token!=LCROP))
														message_erreur(SX0570);

													index_type=-1;  /* à priori pas un tableau */

													nb_dimension=0;

													for(;;) /* parsing des dimensions du tableau */
														{

															if(type_token==LCROP)
								 							 {
										  						cr=lire_token();
																if(cr==-1)
																message_erreur(SX0580);

																strcpy(entier,token);

																if(traceaff==1) printf("\n     struct    %s  %s TABLEAU %d",type,ident,atoi(entier));

																dimension[nb_dimension++]=atoi(entier);
																if(nb_dimension>MAX_DIMENSION)
																	{
																		message_erreur(SX0590);
																	}

																cr=lire_token();
																if(cr==-1)
																	message_erreur(SX0600);

																if(type_token!=LCRCL)
																	message_erreur(SX0610);

																cr=lire_token();

															} else break;
								 						 } /* for de dimension */

												/*	if(nb_dimension>0) */
													index_type=ajout_type(prof_bloc,
																		  type,
																		  STRUCTURE,
																		  dimension,
																		  nb_dimension,
																		  nom_structure,
																		  ident,
																		  nb_champ,
																		  type_pointeur);

													if(traceaff==1) printf("\n     struct ajout champ %s %s ",type,ident);
												/*	ajout_variable(prof_bloc,index_type,type,ident);*/
													/*printf("\n fin ajout variable ");*/
													nb_champ++;

													if(type_token==LPV) break;

													if(type_token!=LV)
														message_erreur(SX0620);


												} /* for champ de même type */
									} break; /* case entier, ... */
								default:
									{
											message_erreur(SX0630);
									}break;

								} /* switch */

								if(traceaff==1) printf("\n     sortie de champ de même type %d",nb_champ);

						 } /* for de tous les champs */

						if (nb_champ==0)
								message_erreur(SX0640);

						cr=lire_token();
						if(cr==-1)
							message_erreur(SX0650);

						if(type_token!=LPV)
								message_erreur(SX0660);

					}break;
				default:
					{
							message_erreur(SX0670);
					}break;
			  }
		}

  }



/* fonction de recherche de type */

int recherche_type(char *type)
 {
	 int i;

	 for(i=0;i<nb_tab_type_variable;i++)
		if(((tab_type_variable[i].genre_variable==ATOME)||
		    (tab_type_variable[i].genre_variable==STRUCTURE))&&
	   		(strcmp(type,tab_type_variable[i].type)==0)) break;


	if(i==nb_tab_type_variable)
	 	return(-1);
	else
		return(i);
 }

/* fonction qui affiche le type  */
void affiche_type(TYPE_VARIABLE *type,int prof)
	{
		int i;
		char decalage[100];

		strcpy(decalage,"--------------------------------------------------------------------------------------------");
		decalage[prof*3]='\0';

		if(traceaff==1) printf("\n%s type=%s index = %d genre = %d",
			decalage,
			type->type,
			recherche_type(type->type),
			type->genre_variable);

		if(type->genre_variable==ATOME)
			{
				if(traceaff==1) printf("\n%s atome ",decalage);
				if(traceaff==1) printf(" bloc = %s dimension %d",
					type->bloc,
					type->nb_dimension);

				if(type->type_pointeur==PASPOINTEUR) { if(traceaff==1) printf(" pas pointeur ");}
				if(type->type_pointeur==POINTEUR) {if(traceaff==1) printf(" * pointeur ");}
				if(type->type_pointeur==POINTEURPOINTEUR) {if(traceaff==1) printf(" ** pointeur ");}
			}

		if(type->genre_variable==STRUCTURE)
			{
				if(traceaff==1) printf("\n%s structure ",decalage);

				if(traceaff==1) printf(" bloc = %s nb champ %d dimension %d",
					type->bloc,
					type->nb_champ,
					type->nb_dimension);

				for(i=0;i<type->nb_champ;i++)
					{
						if(traceaff==1) printf("\n%s champ # %d",decalage,i);
						affiche_type(type->type_variable_ptr[i],prof+1);
					}
				if (type->nb_dimension>0) if(traceaff==1) printf("\n%s",decalage);
				for(i=0;i<type->nb_dimension;i++)
						if(traceaff==1) printf("[%d]",type->dimension[i]);
			}


		if(type->genre_variable==CHAMP)
			{
				if(traceaff==1) printf("\n%s champ %s ",decalage,type->champ_structure);

				if(traceaff==1) printf(" bloc = %s dimension %d",
					type->bloc,
					type->nb_dimension);

				if(type->type_pointeur==PASPOINTEUR) {if(traceaff==1) printf(" pas pointeur ");}
				if(type->type_pointeur==POINTEUR) {if(traceaff==1) printf(" * pointeur ");}
				if(type->type_pointeur==POINTEURPOINTEUR) {if(traceaff==1) printf(" ** pointeur ");}

				affiche_type(&tab_type_variable[recherche_type(type->type)],prof+1);

				if (type->nb_dimension>0)if(traceaff==1) {printf("\n%s",decalage);}
				for(i=0;i<type->nb_dimension;i++)
						if(traceaff==1) printf("[%d]",type->dimension[i]);
			}

		if(type->genre_variable==TABLEAU)
			{
				if(traceaff==1) printf("\n%s tableau ",decalage);
				if(traceaff==1) printf(" bloc = %s nb dimension %d ",type->bloc,type->nb_dimension);
				/*if(type->type_pointeur==PASPOINTEUR) printf(" pas pointeur ");
				if(type->type_pointeur==POINTEUR) printf(" * pointeur ");
				if(type->type_pointeur==POINTEURPOINTEUR) printf(" ** pointeur ");*/

				affiche_type(&tab_type_variable[recherche_type(type->type)],prof+1);

				if(traceaff==1) printf("\n%s",decalage);
				for(i=0;i<type->nb_dimension;i++)
						if(traceaff==1) printf("[%d]",type->dimension[i]);
			}
	}

/* fonction qui affiche la definition de la variable */
void affiche_variable(int index)
 {
	 	if(traceaff==1) printf("\n ################### DEFINITION VARIABLE DEBUT ########################");

		if(traceaff==1) printf("\n ident = %s bloc = %s valeur = %s modify = %d ",
			program.vg[index].ident,
			program.vg[index].bloc,
			program.vg[index].valeur,
		    program.vg[index].modify);

		if(program.vg[index].type_pointeur==PASPOINTEUR) {if(traceaff==1) printf(" pas pointeur ");}
		if(program.vg[index].type_pointeur==POINTEUR) {if(traceaff==1) printf(" * pointeur ");}
		if(program.vg[index].type_pointeur==POINTEURPOINTEUR) {if(traceaff==1) printf(" ** pointeur ");}

		affiche_type(program.vg[index].type_variable_ptr,0);

		if(traceaff==1) printf("\n ################### DEFINITION VARIABLE FIN   ########################");
 }

/* fonction de recherche de variable */
int recherche_variable(char *variable,char *bloc)
 {
	 int i;

	 /* on recherche d'abord une variable locale */

	 for(i=program.nb_vg-1;i>=0;i--)
		 {
					if(strcmp(program.vg[i].bloc,bloc)==0)
						{
							if(strcmp(program.vg[i].ident,variable)==0) break;
						}
		}

     if((i==-1)&&(strcmp(program.vg[i].bloc,"0")!=0)) /* rien de trouvé onn cherche en variable globale */
		{
			  for(i=program.nb_vg-1;i>=0;i--)
		 		{
					if(strcmp(program.vg[i].bloc,"0")==0)
						{
							if(strcmp(program.vg[i].ident,variable)==0) break;
						}
				}
			if(i==-1)
	 				return(-1);
			else return(i);
		}
	 else
		 {
				return(i);
		 }
 }

/* fonction de recherche de fonction */
int recherche_fonction(char *fonction)
 {
	 int i;

	 for(i=0;i<nb_fonction;i++)
		if (strcmp(fonction,tab_fonction[i].ident_fonction)==0) break;


	if(i==nb_fonction)
	 	return(-1);
	else
		return(i);
 }


 int indentation=0;
 char affiche[1000];

 void descend(void)
  {
	  /*indentation--;
	  indentation--;*/
	  indentation--;
	  indentation--;
	  /*printf("\nDescend %d",indentation);*/
	  affiche[indentation]='\0';
	}

 void monte(void)
  {
	  /*printf("\nMonte %d",indentation+1);*/

	  /*affiche[indentation+4]='\0';
	  affiche[indentation+3]='-';*/
	  affiche[indentation+2]=/*'-'*/'\0';
	  affiche[indentation+1]='-';
	  affiche[indentation]='-';
	  indentation++;
	  indentation++;
	  /*indentation++;
	  indentation++;*/
  }

/* analyse de compatibilite des types */


/*#define LCHIFFREENT 43
#define LCHIFFRREEL 44
#define CHAINE      9

#define LENTIER     8
#define LCHAR       24
#define OCTET       26
#define LFLOTTANT   25*/

/*TYPE_VARIABLE {
		int  genre_variable;
		char type[MAX_IDENT];
		char champ_structure[MAX_IDENT];
		TYPE_VARIABLE *type_variable_ptr[MAX_CHAMP];
		int  nb_type_variable;
		int  dimension[MAX_DIMENSION];
		int  nb_dimension;
		int  nb_champ;
		char bloc[PROF_BLOC+1];
		int  type_pointeur;
	};*/

int convertit_type(int type)
 {
	 switch(type)
	  {
		  case LCHIFFREENT:
			  {
				  return(recherche_type("int"));
			  }break;
		  case LCHIFFRREEL:
			  {
				  return(recherche_type("float"));
			  }break;
		  case CHAINE:
			  {
				  return(recherche_type("chaine_system_tab"));
			  }break;
	  }

	  return(-1);
 }

int compatibilite_type(int g,int d)
 {
	if(traceaff==1) printf("\n%s G T = %d type='%s' genre =%d nb dim =%d bloc = %s type ptr = %d ",
			affiche,
			g,
			tab_type_variable[g].type,
			tab_type_variable[g].genre_variable,
			tab_type_variable[g].nb_dimension,
			tab_type_variable[g].bloc,
			tab_type_variable[g].type_pointeur);

	if(traceaff==1) printf("\n%s D T = %d type='%s' genre =%d nb dim =%d bloc = %s type ptr = %d ",
			affiche,
			d,
			tab_type_variable[d].type,
			tab_type_variable[d].genre_variable,
			tab_type_variable[d].nb_dimension,
			tab_type_variable[d].bloc,
			tab_type_variable[d].type_pointeur);

	if(g==d)
		return(g);
	else
		{
			if(traceaff==1) printf("\n%s Type non atome int/float %s %s",affiche,tab_type_variable[g].type,tab_type_variable[d].type);

			if((strcmp(tab_type_variable[g].type,   tab_type_variable[d].type)==0)&&
			   (tab_type_variable[g].type_pointeur==tab_type_variable[d].type_pointeur)&&
	   		   (tab_type_variable[g].nb_dimension== tab_type_variable[d].nb_dimension))
				{
					if(traceaff==1) printf("\n%s même type, même dimension, même type pointeur",affiche);
					return(g);
				}

			message_erreur_warning(SX0675);

			return(g);
		}
 }

/*

atome :     nouvelle_expression(EXP_ATOME,LENTIER/LCHAR ...,"valeur",NULL,0,NULL)
variable :  nouvelle_expression(EXP_VARIABLE,PASPOINTEUR/POINTER/POINTEURPOINTEUR,nom variable,ptr varaibale glob,nb dimen,table des exp des index)
operateur : nouvelle_expression(EXP_OPERATEUR,LMUL/LPLUS ...,Expression1,Expression2,0,NULL)
fonction :  nouvelle_expression(EXP_FONCTION,0,nom de fonction,NULL,nb d'argument,table des exp des arguments)

*/

SEXPRESSION * nouvelle_expression(int type_exp,int operateur_ou_type_atome_ou_indirection,char *arg1,char *arg2,int nb,SEXPRESSION **tab_exp)
	{
 		SEXPRESSION *e;

		e=(SEXPRESSION *)malloc(sizeof(SEXPRESSION));
		if(e==(SEXPRESSION*)NULL)
			message_erreur(SX0680);

		e->gauche=(SEXPRESSION *)NULL;
		e->droit=(SEXPRESSION *)NULL;
		e->type=type_exp;

		switch(type_exp)
			{
				    case EXP_POINTEUR:
						{
							if(traceaff==1) printf("\n %s POINTEUR %s",affiche,arg1);
							e->operateur=0;
							strcpy(e->feuille.spointeur.ident_variable,arg1); /* valeur de l'atome */
							e->feuille.spointeur.index=(SEXPRESSION *)arg2;
						}break;
					case EXP_ATOME:
						{
							if(traceaff==1) printf("\n %s ATOME %s",affiche,arg1);
							e->operateur=0; /* + - / % */ /* penser à ajouter modulo */
							strcpy(e->feuille.satome.valeur,arg1); /* valeur de l'atome */
							e->feuille.satome.type=operateur_ou_type_atome_ou_indirection;
							e->type_resultant=convertit_type(operateur_ou_type_atome_ou_indirection);
						}break;
					/*case EXP_VARIABLE:
						{
							int i;

							printf("\n %s VARIABLE %s %d",affiche,arg1,nb);
							e->operateur=0; /* + - / % */ /* penser à ajouter modulo **/
							/*strcpy(e->feuille.svariable.variable,arg1); /* nom de la variable *
							e->feuille.svariable.variable_ptr=(VARIABLE_GLOBALE *)arg2;
							e->feuille.svariable.dimension[0]=(SEXPRESSION *)NULL;
							e->feuille.svariable.nb_dimension=nb; /* pas d'expression pour les indices *
							e->feuille.svariable.indirection=operateur_ou_type_atome_ou_indirection;
							for(i=0;i<nb;i++)
								e->feuille.svariable.dimension[i]=(SEXPRESSION *)tab_exp[i];
						}break;*/
					case EXP_OPERATEUR:
						{
							if(traceaff==1) printf("\n %s OPERATEUR %d",affiche,operateur_ou_type_atome_ou_indirection);
							e->operateur=operateur_ou_type_atome_ou_indirection; /* + - / % */ /* penser à ajouter modulo */
							if(traceaff==1) printf("\n %s affectation type operateur ",affiche);
							e->gauche=(SEXPRESSION *)arg1;
							if(traceaff==1) printf("\n %s affectation type operateur G= %lx ",affiche,arg1);
							e->droit=(SEXPRESSION *)arg2;
							if(traceaff==1) printf("\n %s affectation type operateur D= %lx ",affiche, arg2);

							/* calcul du type resultant */
							if((e->operateur!=LNEG)&&(e->operateur!=LNON)&&(e->operateur!=LINC)&&(e->operateur!=LDEC))
								{
									if(traceaff==1) printf("\n %s evaluation type resultant 'BINAIRE' %lx %d %d",affiche,&e->type_resultant,
									    e->gauche->type_resultant,e->droit->type_resultant);
									e->type_resultant=compatibilite_type(e->gauche->type_resultant,e->droit->type_resultant);
									if(e->type_resultant==-1)
									 {
										if(traceaff==1) printf("\n%s OPERATEUR argument incompatible G=%d D=%d",affiche,e->gauche->type_resultant,e->droit->type_resultant);
										message_erreur(SX0690);
									 }
									else
										{if(traceaff==1) printf("\n%s OPERATEUR 'BINAIRE' argument compatible %d",affiche,e->type_resultant);}
								}
							else {
									e->type_resultant=e->gauche->type_resultant;
									if(e->operateur!=LNEG)
										{if(traceaff==1) printf("\n%s OPERATEUR 'NEG' argument compatible %d",affiche,e->type_resultant);}
									if(e->operateur!=LNON)
										{if(traceaff==1) printf("\n%s OPERATEUR 'NON' argument compatible %d",affiche,e->type_resultant);}
									if(e->operateur!=LINC)
										{if(traceaff==1) printf("\n%s OPERATEUR 'INC' argument compatible %d",affiche,e->type_resultant);}
									if(e->operateur!=LDEC)
										{if(traceaff==1) printf("\n%s OPERATEUR 'DEC' argument compatible %d",affiche,e->type_resultant);}
								 }

						}break;
					case EXP_FONCTION:
						{
							int i;
							int index_fonction;
							int index_type;

							if(traceaff==1) printf("\n%s FONCTION %s %d",affiche,arg1,nb);
							strcpy(e->feuille.sfonction.fonction,arg1);
							e->feuille.sfonction.nb_argument=nb;
							for(i=0;i<nb;i++)
								e->feuille.sfonction.argument_ptr[i]=/*(SEXPRESSION *)*/tab_exp[i];

							index_fonction=recherche_fonction(arg1);

							if(index_fonction==-1)
									message_erreur(SX0700);
							index_type=recherche_type(tab_fonction[index_fonction].type_variable_retournee_ptr->type);
							if(index_type==-1)
									message_erreur(SX0710);

							if(traceaff==1) printf("\n%s Type retourne %d '%s' par la fonction '%s'",
						   			affiche,
								    index_type,
									tab_fonction[index_fonction].type_variable_retournee_ptr->type,
								    arg1);
							e->type_resultant=index_type;

						}break;
			}
		return(e);
   }

/*
INST_IF : nouvelle_instruction(NST_IF,else ou pas,expression condition,inst if,inst else,NULL,NULL,
									NULL,0,NULL,NULL,NULL,NULL)
INST_FOR :nouvelle_instruction(INST_FOR,0,condition du for,inst du for,NULL,debu for,increment for,
									NULL,0,NULL,NULL,NULL,NULL)
INST_DO_REPEAT : nouvelle_instruction(INST_DO_REPEAT,0,condition du repeat,inst du repeat,NULL,NULL,NULL,
									NULL,0,NULL,NULL,NULL,NULL)
INST_SWITCH : nouvelle_instruction(INST_SWITCH ,0,expression du switch,NULL,NULL,NULL,NULL,
						NULL,nb de case ou default,NULL,table des inst,table de breaks,NULL)
INST_GOTO :
INST_RETURN :
INST_BREAK :
INST_CASE :
INST_CONTINUE :
INST_AFFECTATION : nouvelle_instruction(INST_AFFECTATION ,0,exp affectee,NULL,NULL,NULL,NULL,
									NULL,0,NULL,NULL,NULL,NULL)
INST_FONCTION : nouvelle_instruction(INST_FONCTION ,0,exp de fonction,NULL,NULL,NULL,NULL,
									NULL,0,NULL,NULL,NULL,NULL)
INST_BLOC : nouvelle_instruction(INST_BLOC,0,NULL,NULL,NULL,NULL,NULL,
									NULL,int nb instruction,NULL,liste inst du bloc ,NULL,NULL)
						{
							tab_instruction[nb_instruction].instruction.sbloc.nb_instruction=0;
							tab_instruction[nb_instruction].instruction.sbloc.liste_instruction[0]=(INSTRUCTION *)NULL;
					    }break;
*/

INSTRUCTION * nouvelle_instruction(char *bloc_prof,int type,int selse,SEXPRESSION *exp1,INSTRUCTION *inst1,INSTRUCTION *inst2,SAFFECTATION *aff1,SAFFECTATION *aff2,
									SAFFECTATION    *var1,int nb,SEXPRESSION **tab_exp,INSTRUCTION **tab_inst,int *tab_break,char *nom_fonction)
  {
	  int i;

		switch(type)
			{
					case INST_ARRSIZE:
						{
						}break;
					case INST_ARRINIT:
						{
						}break;
					case INST_ARRBUILD:
						{
						}break;
					case INST_ARRSUBSET:
						{
						}break;
					case INST_ACQUIRE:
						{
							strcpy(tab_instruction[nb_instruction].instruction.smutex_acquire,nom_fonction);
					    }break;
					case INST_RELEASE:
						{
							strcpy(tab_instruction[nb_instruction].instruction.smutex_release,nom_fonction);
					    }break;
					case INST_INLINE:
						{
							strcpy(tab_instruction[nb_instruction].instruction.sinline,nom_fonction);
					    }break;
					case INST_IF :
						{
							tab_instruction[nb_instruction].instruction.sif.selse=selse;
							tab_instruction[nb_instruction].instruction.sif.argument=(SEXPRESSION *) exp1;
							tab_instruction[nb_instruction].instruction.sif.corps_if=(INSTRUCTION *) inst1;
							tab_instruction[nb_instruction].instruction.sif.corps_else=(INSTRUCTION *) inst2;
					    }break;
					case INST_FOR :
						{
							tab_instruction[nb_instruction].instruction.sfor.argument_init_ptr=(SAFFECTATION *) aff1;
							tab_instruction[nb_instruction].instruction.sfor.expression_ptr=(SEXPRESSION *)exp1;
							tab_instruction[nb_instruction].instruction.sfor.argument_increment_ptr=(SAFFECTATION *)aff2;
							tab_instruction[nb_instruction].instruction.sfor.corps_for=(INSTRUCTION *)inst1;
					    }break;
					case INST_DO_REPEAT :
						{
							tab_instruction[nb_instruction].instruction.sdo_repeat.expression_ptr=(SEXPRESSION *)exp1;
							tab_instruction[nb_instruction].instruction.sdo_repeat.corps=(INSTRUCTION *)inst1;
					    }break;
					case INST_SWITCH :
						{
							/*tab_instruction[nb_instruction].instruction.sswitch.expression=(SEXPRESSION *)exp1;
							for(i=0;i<nb;i++)
								{
									tab_instruction[nb_instruction].instruction.sswitch.cases[i]=(INSTRUCTION *)tab_inst[i];
									tab_instruction[nb_instruction].instruction.sswitch.type_case[i]=tab_break[i]; /* break ou pas break */
								/*}*/
							/*tab_instruction[nb_instruction].instruction.sswitch.nb_case=nb;*/
							/* à compléter */
					    }break;
					case INST_LABEL:
					    {
							strcpy(tab_instruction[nb_instruction].instruction.slabel,nom_fonction);
					    } break;
					case INST_GOTO :
						{
							strcpy(tab_instruction[nb_instruction].instruction.sgoto,nom_fonction);
					    }break;
					case INST_RETURN :
						{
							tab_instruction[nb_instruction].instruction.sreturn.expression_ptr=(SEXPRESSION *)exp1;
							tab_instruction[nb_instruction].instruction.sreturn.exp=selse;
					    }break;
					case INST_EXIT:
						{
						}break;
					case INST_PRECEDES:
						{
						}break;
					case INST_BREAK :
						{
					    }break;
					case INST_CASE :
						{
					    }break;
					case INST_CONTINUE :
						{
					    }break;
					case INST_AFFECTATION :
						{
							tab_instruction[nb_instruction].instruction.saffectation=(SAFFECTATION *)var1;
							/*tab_instruction[nb_instruction].instruction.saffectation.valeur_affectee=(SEXPRESSION *)exp1;*/
					    }break;
					case INST_FONCTION :
						{
							tab_instruction[nb_instruction].instruction.sfonction=(SEXPRESSION *)exp1;
					    }break;
					case INST_BLOC :
						{
							/*tab_instruction[nb_instruction].instruction.sbloc.nb_instruction=nb; /* nb d'instructions, si >1 liste d'instruction */
							/*tab_instruction[nb_instruction].instruction.sbloc.liste_instruction=(INSTRUCTION *)tab_inst[i];*/ /* pointeur sur l'instruction ou la liste d'instruction */
					    }break;
			}

		strcpy(tab_instruction[nb_instruction].bloc,bloc_prof);
		tab_instruction[nb_instruction].index=nb_instruction;
	  	tab_instruction[nb_instruction].type_instruction=type;
		return(&tab_instruction[nb_instruction++]);
  }


/*

atome :     nouvelle_expression(EXP_ATOME,LENTIER/LCHAR ...,"valeur",NULL,0,NULL)
variable :  nouvelle_expression(EXP_VARIABLE,PASPOINTEUR/POINTER/POINTEURPOINTEUR,nom variable,ptr varaibale glob,nb dimen,table des exp des index)
operateur : nouvelle_expression(EXP_OPERATEUR,LMUL/LPLUS ...,Expression1,Expression2,0,NULL)
fonction :  nouvelle_expression(EXP_FONCTION,0,nom de fonction,NULL,nb d'argument,table des exp des arguments)

*/


SEXPRESSION * analyse_expression(char *);
SEXPRESSION * analyse_recursive_expression(char *);
SEXPRESSION * analyse_recursive_expression_logique_ou(char *);


SVARIABLE *analyse_synt_variable_recursive(TYPE_VARIABLE *type,char *bloc_prof)
 {
	 SVARIABLE *exp,*expr;
	 int i;

	 exp=expr=NULL;

	 monte();

	 cr=lire_token();
	 if(cr==-1)
		message_erreur(SX0720);

	 if(traceaff==1) printf("\n%s A token analyse = %s %d",affiche,token,type_token);

	 switch(type_token)
	  {
		  case LCROP:
		   {
			   	if(traceaff==1) printf("\n%s Tableau detecte type =%s genre =%d dim = %d",affiche,type->type,type->genre_variable,type->nb_dimension);

				/*if( (type->genre_variable!=TABLEAU)&&
				   ((type->genre_variable!=CHAMP)&&(type->nb_dimension>0))
				  )
					 */

				if(type->genre_variable==TABLEAU)
					{
						if(traceaff==1) printf("\n%s il s'agit d'un tableau hors champ de dimension %d",affiche,type->nb_dimension);



						exp=(SVARIABLE *)malloc(sizeof(SVARIABLE));
	 					if(exp==NULL)
							message_erreur(SX0730);

	 					exp->type_svariable=SVARIABLE_TABLEAU_SEUL; /* c'est un champ seul */
	 					exp->type=type; /* pointe sur le type */
						exp->ligne=ligne_courante;

						i=0;

						exp->nb_dimension=0;

						for(;;)
							{
								SEXPRESSION *expression;

								if(i>type->nb_dimension)
									message_erreur(SX0740);

								/* on consomme le [ */
								cr=lire_token();
	 							if(cr==-1)
									message_erreur(SX0750);

								expression=analyse_expression(bloc_prof);

								if(traceaff==1) printf("\n%s B token analyse = %s %d",affiche,token,type_token);

								if(type_token!=LCRCL)
									message_erreur(SX0760);

								exp->dimension[i]=expression;

								i++;

								exp->nb_dimension++;

								/* on consomme le ] */
								cr=lire_token();
	 							if(cr==-1)
									message_erreur(SX0770);

							    if(type_token!=LCROP)
									break;
							}

						if(traceaff==1) printf("\n%s %d dimensions ont été analysées, token courant=%s ",affiche,i,token);

						if(i!=type->nb_dimension)
							message_erreur(SX0780);

						cr=retour_arriere();
			   			cr=retour_arriere();

						cr=lire_token();
			   			if(cr==-1)
				 			 message_erreur(SX0790);

						exp->suivant=analyse_synt_variable_recursive(&tab_type_variable[recherche_type(type->type)],bloc_prof);

					}
				else
				if((type->genre_variable==CHAMP)&&(type->nb_dimension>0))
					{
						if(traceaff==1) printf("\n%s il s'agit d'un tableau d'un champ",affiche);

						exp=(SVARIABLE *)malloc(sizeof(SVARIABLE));
	 					if(exp==NULL)
							message_erreur(SX0800);

						strcpy(exp->ident_champ,type->champ_structure); /* nom du champ */
	 					exp->type_svariable=SVARIABLE_CHAMP_TABLEAU; /* c'est un champ seul */
	 					exp->type=type; /* pointe sur le type */
						exp->ligne=ligne_courante;
						exp->nb_dimension=0;

						i=0;
						for(;;)
							{
								SEXPRESSION *expression;

								if(i>type->nb_dimension)
									message_erreur(SX0810);

								/* on consomme le [ */
								cr=lire_token();
	 							if(cr==-1)
									message_erreur(SX0820);

								expression=analyse_expression(bloc_prof);

								if(traceaff==1) printf("\n%s C token analyse = %s %d",affiche,token,type_token);

								if(type_token!=LCRCL)
									message_erreur(SX0830);

								exp->dimension[i]=expression;

								i++;
								exp->nb_dimension++;

								/* on consomme le ] */
								cr=lire_token();
	 							if(cr==-1)
									message_erreur(SX0840);

								if(type_token!=LCROP)
									break;
							}

						if(traceaff==1) printf("\n%s %d dimensions ont été analysées, token courant = %s ",affiche,i,token);

						if(i!=type->nb_dimension)
							message_erreur(SX0850);

						if(traceaff==1) printf("\n%s champ %s, tableau de %d dimension de type %s/%d",
							affiche,
							type->champ_structure,
							type->nb_dimension,
							type->type,
							recherche_type(type->type));

						/* on consomme se repostionne */

						/*if(type_token==LPOINT)
							{*/
								cr=retour_arriere();
			   					cr=retour_arriere();

								cr=lire_token();
			   					if(cr==-1)
				 			 		message_erreur(SX0860);

						exp->suivant=analyse_synt_variable_recursive(&tab_type_variable[recherche_type(type->type)],bloc_prof);
							/*}
						printf("\n%s Fin d'analyse du champ type tableau token courant = %s",affiche,token);*/

					}
				else message_erreur(SX0870);

			   if(traceaff==1) printf("\n%s Fin de tableau ",affiche);
			  /* cr=retour_arriere();
			   cr=retour_arriere();
			   cr=lire_token();
			   if(cr==-1)
				   message_erreur("\n Erreur Fatale #154 : fin prématuré du fichier source dans une variable ");*/
			   if(traceaff==1) printf("\n%s Fin tableau, on se repositionne sur le token %s",affiche,token);

		   }break;
		  case LPOINT:
		  case LINDIRECT:
		   {
			   int type_indirection;

			   type_indirection=type_token;

			   if(traceaff==1) printf("\n%s Champ de structure detecte : type = %s genre = %d",affiche,type->type,type->genre_variable);

			   if((type->genre_variable!=STRUCTURE)&&(type->genre_variable!=CHAMP)) /*patch 27/02 pb de champ */
				   message_erreur(SX0880);

			    cr=lire_token();
				if(cr==-1)
					message_erreur(SX0890);

				if(type_token!=LIDENT)
					message_erreur(SX0900);

				if(type->genre_variable==STRUCTURE)
					{
						if(traceaff==1) printf("\n%s C'est une structure : type = %s genre = %d",affiche,type->type,type->genre_variable);
						/* recherche du champ */
						for(i=0;i<type->nb_champ;i++)
							if(strcmp(type->type_variable_ptr[i]->champ_structure,token)==0) break;

						if(i==type->nb_champ)
							message_erreur(SX0910);
						else
							{
									if(traceaff==1) printf("\n%s le champ %s existe, de type %s",affiche,token,type->type_variable_ptr[i]->type);
							}

						exp=(SVARIABLE *)malloc(sizeof(SVARIABLE));
	 					if(exp==NULL)
							message_erreur(SX0920);

						strcpy(exp->ident_champ,token); /* nom du champ */
	 					exp->type_svariable=SVARIABLE_CHAMP_SEUL; /* c'est un champ seul */
	 					exp->type=type->type_variable_ptr[i]; /* pointe sur le type */
						exp->ligne=ligne_courante;
						exp->indirection=type_indirection; /* type d'indirection */

						if(traceaff==1) printf("\n%s y-a-t-il un champ de champ ou un tableau de champ",affiche);

						if(type->type_variable_ptr[i]->nb_dimension==0)
							exp->suivant=analyse_synt_variable_recursive(/*type->type_variable_ptr[i]*/
								&tab_type_variable[recherche_type(type->type_variable_ptr[i]->type)],
								bloc_prof);
						else
							exp->suivant=analyse_synt_variable_recursive(type->type_variable_ptr[i]
								/*&tab_type_variable[recherche_type(type->type_variable_ptr[i]->type)]*/,
								bloc_prof);
					}
				else /* c'est unn champ */
					{
						if(traceaff==1) printf("\n%s C'est un champ feuille '%s': type = %s genre = %d nb champ =%d",
						affiche,token,type->type,type->genre_variable,type->nb_champ);

						for(i=0;i<type->nb_champ;i++)
							if(strcmp(type->type_variable_ptr[i]->champ_structure,token)==0) break;

						if(i==type->nb_champ)
							message_erreur(SX0930);
						else
							{
									if(traceaff==1) printf("\n%s le champ feuille %s existe, de type %s",affiche,token,type->type_variable_ptr[i]->type);
							}

						exp=(SVARIABLE *)malloc(sizeof(SVARIABLE));
	 					if(exp==NULL)
							message_erreur(SX0940);

						strcpy(exp->ident_champ,token); /* nom du champ */
	 					exp->type_svariable=SVARIABLE_CHAMP_SEUL; /* c'est un champ seul */
	 					exp->type=type->type_variable_ptr[i]; /* pointe sur le type */
						exp->ligne=ligne_courante;
						exp->indirection=type_indirection; /* type d'indirection */

						if(traceaff==1) printf("\n%s y-a-t-il un champ de champ ou un tableau de champ",affiche);

						exp->suivant=analyse_synt_variable_recursive(/*type->type_variable_ptr[i]*/
								&tab_type_variable[recherche_type(type->type_variable_ptr[i]->type)],
								bloc_prof);
					}


		   }
		  break;
		  default:
		   {
			   if(traceaff==1) printf("\n%s Fin d'analyse variable ",affiche);
			   cr=retour_arriere();
			   cr=retour_arriere();
			   cr=lire_token();
			   if(cr==-1)
				   message_erreur(SX0950);
			   if(traceaff==1) printf("\n%s On se repositionne sur le token %s",affiche,token);

			   exp=expr=NULL;
		   }break;
	  }

	 descend();

	 return(exp);
 }

/* analyse de variable */

SEXPRESSION * analyse_synt_variable(char *bloc_prof,int type_pointeur_var)
 {
	 char nom_variable[MAX_IDENT];
	 int index;
	 SEXPRESSION *exp;
	 SVARIABLE   *ptr;

	 monte();

	 index=recherche_variable(token,bloc_prof);

	 if(index==-1)
		 message_erreur(SX0960);

	 strcpy(nom_variable,token);

	 if(traceaff==1) printf("\n%s analyse syntaxique de la variable %s index=%d ",affiche,token,index);


	 if(type_pointeur_var==TYP_PTR_VAR_ADRESSE) {if(traceaff==1) printf(" type ptr = '&' ");}
	 if(type_pointeur_var==TYP_PTR_VAR_NORMAL) {if(traceaff==1) printf(" type ptr =normal ");}
	 if(type_pointeur_var==TYP_PTR_VAR_POINTEUR) {if(traceaff==1) printf(" type ptr = '*' ");}
	 if(type_pointeur_var==TYP_PTR_VAR_POINTEUR_POINTEUR) {if(traceaff==1) printf(" type ptr = '**' ");}

	 affiche_variable(index);

	 exp=(SEXPRESSION *)malloc(sizeof(SEXPRESSION));
	 if(exp==NULL)
		message_erreur(SX0970);

	 exp->type=EXP_VARIABLE; /* il s'agit d'une variable */
	 strcpy(exp->feuille.svariable.ident_variable,nom_variable); /* nom de la variable */
	 exp->gauche=exp->droit=(SEXPRESSION *)NULL; /* pas d'arborescence */
	 exp->feuille.svariable.type_svariable=SVARIABLE_VARIABLE; /* c'estune variable */
	 exp->feuille.svariable.variable_ptr=(VARIABLE_GLOBALE *)&program.vg[index]; /* pointe sur la variable */
	 exp->feuille.svariable.ligne=ligne_courante;
	 exp->feuille.svariable.indirection=type_pointeur_var; /* type d'indirection */
	 exp->feuille.svariable.suivant=analyse_synt_variable_recursive(program.vg[index].type_variable_ptr,bloc_prof);

	 ptr=exp->feuille.svariable.suivant;

	 if(ptr!=NULL)
		{
	 		for(;ptr->suivant!=NULL;)
				{
						ptr=ptr->suivant;
				}
			exp->type_resultant=recherche_type(ptr->type->type);
			/*printf("\n variable complexe = '%s'\n",ptr->type->type);*/
		}
	 else
		 {
			exp->type_resultant=recherche_type(exp->feuille.svariable.variable_ptr->type_variable_ptr->type);
			/*printf("\n variable simple = '%s'\n",exp->feuille.svariable.variable_ptr->type_variable_ptr->type);*/
		 }

	 if(traceaff==1) printf("\n%s Fin Analyse  variable, token courant =  %s",affiche,token);

	 descend();

	 return(exp);
 }


void ajout_fonctions_appelees(char *nom_fonction)
 {
	 int i;

	 for(i=0;i<nb_fonctions_appelees;i++)
		 if(strcmp((char *)&tab_fonctions_appelees[i][0],nom_fonction)==0)
			 	break;

	if(i==nb_fonctions_appelees)
		{
			strcpy((char *)&tab_fonctions_appelees[nb_fonctions_appelees][0],nom_fonction);
			nb_fonctions_appelees++;
		}
 }

/* analyse de fonction */

SEXPRESSION * analyse_synt_fonction(char *bloc_prof)
 {
	 int i;
	 int nb_argument;
	 SEXPRESSION *exp;
	 SEXPRESSION *argument[MAX_PARAMETRE];
	 char nom_fonction[MAX_IDENT];

	 monte();

	 if(traceaff==1) printf("\n%s Analyse de l'appel de fonction %s",affiche,token);

	 strcpy(nom_fonction,token);

	 /* trace l'appelle de la fonction */
	 ajout_fonctions_appelees(nom_fonction);

	 cr=lire_token();
	 if(cr==-1)
		message_erreur(SX0980);

	 if(type_token!=LOP)
		message_erreur(SX0990);

	 cr=lire_token();
	 if(cr==-1)
		message_erreur(SX1000);

	 nb_argument=0;
	/* analyse de tous les paramètres */
	 for(;;)
		{
			if(type_token==LCL) break;

			if(traceaff==1) printf("\n%s Analyse de l'argument %d %s",affiche,nb_argument,token);

			argument[nb_argument]=analyse_recursive_expression_logique_ou(bloc_prof);

			if(traceaff==1) printf("\n%s Fin Analyse de l'argument %d %s",affiche,nb_argument,token);

			nb_argument++;

			if(type_token==LV)
				{
 					cr=lire_token();
					if(cr==-1)
						message_erreur(SX1010);
				}
			else if(type_token!=LCL)
						message_erreur(SX1020);
		}
	/* fin d'analyse */

/*SEXPRESSION * nouvelle_expression(int type_exp,int operateur_ou_type_atome_ou_indirection,char *arg1,char *arg2,int nb,SEXPRESSION **tab_exp)*/

	exp=nouvelle_expression(EXP_FONCTION,0,(char *)nom_fonction,(char *)NULL,nb_argument,(SEXPRESSION **)&argument[0]);

	if(traceaff==1) printf("\n%s Fin Analyse de la fonction %s %d %s",affiche,nom_fonction,nb_argument,token);

	/*cr=lire_token();
	if(cr==-1)
		message_erreur("\n Erreur Fatale : fin prématuré du fichier source dans l'expression/fonction ");*/

	descend();

	return(exp);
 }

/* analyse syntaxique d'une fonction ou varibale */

SEXPRESSION * analyse_fonction_ou_variable(char * bloc_prof,int type_pointeur_var)
  {
	  int index;
	  SEXPRESSION *exp,*exp1;

	  monte();

	  if(traceaff==1) printf("\n A %s analyse_fonction_ou_variable",affiche);

	  index=recherche_variable(token,bloc_prof);

	  if(index!=-1)
		  {
			  exp=analyse_synt_variable(bloc_prof,type_pointeur_var);

			  /* on regrde ce qu'il y a après la variable */
			  cr=lire_token();
	   		  if(cr==-1)
		 		 message_erreur(SX1030);

			  if(type_token==LINC)
				  {

					  /* cr=lire_token();
	   			       if(cr==-1)
		 					message_erreur("\n Erreur Fatale #811 : fin prématuré du fichier source dans l'expression INCREMENT ");*/

						exp1=exp;
						exp=nouvelle_expression(EXP_OPERATEUR,LINC,(char *)exp1,(char *)NULL,0,NULL);
				  }
			  else if(type_token==LDEC)
			      {
					  /* cr=lire_token();
	   			       if(cr==-1)
		 					message_erreur("\n Erreur Fatale #812 : fin prématuré du fichier source dans l'expression DECREMENT ");*/

					   exp1=exp;
			 		   exp=nouvelle_expression(EXP_OPERATEUR,LDEC,(char *)exp1,(char *)NULL,0,NULL);
				  }
			  else
			     {
					  /* on se repositionne */
					  retour_arriere();
					  retour_arriere();
					  cr=lire_token();
	   			      if(cr==-1)
		 					message_erreur(SX1040);
			     }
		  }
	  else
		  {
		  	index=recherche_fonction(token);
			if(index==-1)
				message_erreur(SX1050);
			exp=analyse_synt_fonction(bloc_prof);
	      }

	 descend();

	 return(exp);
  }

/* analyse indirection */


SEXPRESSION * analyse_indirection(char * bloc_prof)
  {
	  int index;
	  SEXPRESSION *exp,*exp1;
	  char ident_ptr[MAX_IDENT];

	  monte();

	  if(traceaff==1) printf("\n A %s analyse_indirection",affiche);

	  /* on lit la '(' */

	  cr=lire_token();
	  if(cr==-1)
		 		 message_erreur(SX1060);

	  if(type_token!=LIDENT)
		{
				 message_erreur(SX1070);
		}

	  index=recherche_variable(token,bloc_prof);

	  if(index==-1)
		{
			   message_erreur(SX1080);
		}

	  strcpy(ident_ptr,token);

	  if(traceaff==1) printf("\n %s identifiant pointeur = %s ",affiche,ident_ptr);

	  if(program.vg[index].type_pointeur!=POINTEUR)
		{
			  message_erreur(SX1090);
		}

	  /* on lit et on se postionne sur le + */
	  cr=lire_token();
	  if(cr==-1)
		 	message_erreur(SX1100);

	  if(type_token!=LPLUS)
		    message_erreur(SX1110);

      /* on lit et on se postionne sur l'expression*/
	  cr=lire_token();
	  if(cr==-1)
		 	message_erreur(SX1120);

	  exp1=analyse_expression(bloc_prof);

	  if(type_token!=LCL)
		    message_erreur(SX1130);

	  descend();

	  exp=nouvelle_expression(EXP_POINTEUR,0,(char *)ident_ptr,(char *)exp1,0,NULL);

	  exp->feuille.spointeur.variable_ptr=(VARIABLE_GLOBALE *)&program.vg[index]; /* pointe sur la variable */
	  exp->feuille.spointeur.ligne=ligne_courante;/* ligne */

	  return(exp);
  }


/* analyse syntaxique d'un atome qui peut être un appel de fonction, un atome eg entier ou une variable */

SEXPRESSION * analyse_atome(char * bloc_prof)
  {
	   SEXPRESSION *exp;
	   int type_pointeur_var;

	   /*
#define TYP_PTR_VAR_ADRESSE 		  1
#define TYP_PTR_VAR_NORMAL  		  2
#define TYP_PTR_VAR_POINTEUR 		  3
#define TYP_PTR_VAR_POINTEUR_POINTEUR 4 */

	   monte();

	   if(traceaff==1) printf("\n A %s analyse_atome",affiche);

	   type_pointeur_var=TYP_PTR_VAR_NORMAL;

	   switch(type_token)
	    {
		   case LCHIFFRREEL:
		   case CHAINE:
		   case LCHIFFREENT:
			   {
				    exp=nouvelle_expression(EXP_ATOME,type_token,(char *)token,(char *)NULL,0,NULL);
				    if(traceaff==1) printf("\n B %s atome = %s",affiche,token);
			   }break;
		   case LMUL: /* cas des pointeurs et des pointeurs de pointeurs */
			   {
					if(traceaff==1) printf("\n X %s * detectee",affiche);
					cr=lire_token();
	   			    if(cr==-1)
		 				message_erreur(SX1140);

					type_pointeur_var=TYP_PTR_VAR_POINTEUR;

					if(type_token==LMUL)
						{
							if(traceaff==1) printf("\n Z %s ** detectee",affiche);
							cr=lire_token();
	   			   			if(cr==-1)
		 						message_erreur(SX1150);
							type_pointeur_var=TYP_PTR_VAR_POINTEUR_POINTEUR;
						}

					if(type_token==LOP)
						{
						    exp=analyse_indirection(bloc_prof);
						}
					else
						exp=analyse_fonction_ou_variable(bloc_prof,type_pointeur_var);
			  } break;
		   case LET :/* cas de la demande d'adresse */
		      {
				if(traceaff==1) printf("\n Y %s & detectee",affiche);

				type_pointeur_var=TYP_PTR_VAR_ADRESSE;

				cr=lire_token();
	   			    if(cr==-1)
		 				message_erreur(SX1160);

					exp=analyse_fonction_ou_variable(bloc_prof,type_pointeur_var);
		      } break;
		   case LIDENT: /* fonction ou variable */
		      {
					exp=analyse_fonction_ou_variable(bloc_prof,type_pointeur_var);
		      } break;
	       case LOP: /* expression parenthésée */
		       {
				    if(traceaff==1) printf("\n C %s ( = %s",affiche,token);
					cr=lire_token();
	   			    if(cr==-1)
		 				message_erreur(SX1170);
					exp=analyse_recursive_expression_logique_ou(bloc_prof);
					/*cr=lire_token();
	   			    if(cr==-1)
		 				message_erreur("\n Erreur Fatale : fin prématuré du fichier source dans l'expression ");
					if(traceaff==1) printf("\n D %s ) = %s",affiche,token);*/
			   }break;
		   default:
		   	{
				message_erreur(SX1180);
			}

		}

	  cr=lire_token();
	  if(cr==-1)
		 message_erreur(SX1190);

	  descend();

	  return(exp);
  }

 /* analyse syntaxique priorisant le neg */

SEXPRESSION * analyse_atome_neg(char *bloc_prof)
 {
	 SEXPRESSION *exp,*gauche;

	 monte();

	 if(traceaff==1) printf("\n E0%s analyse - ",affiche);

	 if(type_token==LMOINS)
		 {
			  if(traceaff==1) printf("\n E1%s analyse MOINS ",affiche);

			  cr=lire_token();
	   		  if(cr==-1)
	 				message_erreur(SX1200);

			  if(traceaff==1) printf("\n E2%s  = %s",affiche,token);

			  gauche=analyse_atome(bloc_prof);

			  exp=nouvelle_expression(EXP_OPERATEUR,LNEG,(char *)gauche,(char *)NULL,0,NULL);

			  if(traceaff==1) printf("\n E3%s  = %s",affiche,token);
	     }
	 else
		 {
			 exp=analyse_atome(bloc_prof);
		 }

	 descend();

	 return(exp);
 }

/* analyse syntaxique priorisant le non */

SEXPRESSION * analyse_atome_non(char *bloc_prof)
 {
	 SEXPRESSION *exp,*gauche;

	 monte();

	 if(traceaff==1) printf("\n E0%s analyse NON ",affiche);

	 if(type_token==LNON)
		 {
			  if(traceaff==1) printf("\n E1%s analyse NON ",affiche);

			  cr=lire_token();
	   		  if(cr==-1)
	 				message_erreur(SX1210);

			  if(traceaff==1) printf("\n E2%s  = %s",affiche,token);

			  gauche=analyse_atome_neg(bloc_prof);

			  exp=nouvelle_expression(EXP_OPERATEUR,LNON,(char *)gauche,(char *)NULL,0,NULL);

			  if(traceaff==1) printf("\n E3%s  = %s",affiche,token);
	     }
	 else
		 {
			 exp=analyse_atome_neg(bloc_prof);
		 }

	 descend();

	 return(exp);
 }


/* analyse syntaxique priorisant le >> et << */

SEXPRESSION * analyse_recursive_shr_shl(char *bloc_prof)
  {
	   SEXPRESSION *gauche,*droite,*exp;
	   int operateur;

	   monte();

	   if(traceaff==1) printf("\n EE %s analyse SHR et SHL ",affiche);

	   gauche=analyse_atome_non(bloc_prof);

	   switch(type_token)
		 {
		   case LSHL:
		   case LSHR:
			   {
				   operateur=type_token;
				   if(traceaff==1) printf("\n FE %s operateur = %s",affiche,token);
				   cr=lire_token();
	   			   if(cr==-1)
		 				message_erreur(SX1220);
				   droite=analyse_recursive_shr_shl(bloc_prof);
				   if(traceaff==1) printf("\n GE %s  = %s",affiche,token);
				   exp=nouvelle_expression(EXP_OPERATEUR,operateur,(char *)gauche,(char *)droite,0,NULL);
			   }break;
			default:
			  {
		 	   	   exp=gauche;
			  }break;
	     }

	  descend();

	  return(exp);
  }

/* analyse syntaxique priorisant le * et / */

SEXPRESSION * analyse_recursive(char *bloc_prof)
  {
	   SEXPRESSION *gauche,*droite,*exp;
	   int operateur;

	   monte();

	   if(traceaff==1) printf("\n E %s analyse MUL et DIV, ET, MODULO ",affiche);

	   gauche=analyse_recursive_shr_shl(bloc_prof);

	   switch(type_token)
		 {
		   case LET:
		   case LMUL:
		   case LDIV:
		   case LMODULO:
			   {
				   operateur=type_token;
				   if(traceaff==1) printf("\n F %s operateur = %s",affiche,token);
				   cr=lire_token();
	   			   if(cr==-1)
		 				message_erreur(SX1230);
				   droite=analyse_recursive(bloc_prof);
				   if(traceaff==1) printf("\n G %s  = %s",affiche,token);
				   exp=nouvelle_expression(EXP_OPERATEUR,operateur,(char *)gauche,(char *)droite,0,NULL);
			   }break;
			default:
			  {
		 	   	   exp=gauche;
			  }break;
	     }

	  descend();

	  return(exp);
  }

/* analyse syntaxique priorisant les + et - */

SEXPRESSION * analyse_recursive_expression_arithmetique(char *bloc_prof)
  {
	  SEXPRESSION *gauche,*droite,*exp;
	  int operateur;

	  monte();

	  if(traceaff==1) printf("\n H %s analyse PLUS et MOINS ",affiche);

	  if(traceaff==1) printf("\n I %s  = %s",affiche,token);

	  gauche=analyse_recursive(bloc_prof);

	  if(traceaff==1) printf("\n J %s  = %s",affiche,token);

	  if((type_token==LMOINS)||
		 (type_token==LPLUS)||
	     (type_token==LOU))
	 		{
				operateur=type_token;
				if(traceaff==1) printf("\n K %s operateur = %s",affiche,token);
				cr=lire_token();
	  			if(cr==-1)
					 message_erreur(SX1240);
				if(traceaff==1) printf("\n L %s  = %s",affiche,token);
				droite=analyse_recursive_expression_arithmetique(bloc_prof);
			    if(traceaff==1) printf("\n M %s  = %s",affiche,token);
				exp=nouvelle_expression(EXP_OPERATEUR,operateur,(char*)gauche,(char *)droite,0,NULL);
			}
	  else exp=gauche;

	  if(traceaff==1) printf("\n N %s  = %s",affiche,token);

	  descend();

	  return(exp);
  }


/* analyse syntaxique priorisant les == != */

SEXPRESSION * analyse_recursive_expression_comparaison(char *bloc_prof)
  {
	  SEXPRESSION *gauche,*droite,*exp;
	  int operateur;

	  monte();

	  if(traceaff==1) printf("\n O %s analyse ==,<=,>=,!=,<,> ",affiche);

	  if(traceaff==1) printf("\n P %s  = %s",affiche,token);

	  gauche=analyse_recursive_expression_arithmetique(bloc_prof);

	  if(traceaff==1) printf("\n Q %s  = %s",affiche,token);

	  if((type_token==LCOMPEG)||
		 (type_token==LCOMPDIFF)||
	     (type_token==LCOMPSUP)||
		 (type_token==LCOMPINF)||
		 (type_token==LCOMPSUPEG)||
		 (type_token==LCOMPINFEG)
	 	)
	 		{
				operateur=type_token;
				if(traceaff==1) printf("\n R %s operateur = %s",affiche,token);
				cr=lire_token();
	  			if(cr==-1)
					 message_erreur(SX1250);
				if(traceaff==1) printf("\n S %s  = %s",affiche,token);
				droite=analyse_recursive_expression_comparaison(bloc_prof);
			    if(traceaff==1) printf("\n T %s  = %s",affiche,token);
				exp=nouvelle_expression(EXP_OPERATEUR,operateur,(char*)gauche,(char *)droite,0,NULL);
			}
	  else exp=gauche;

	  if(traceaff==1) printf("\n U %s  = %s",affiche,token);

	  descend();

	  return(exp);
  }


/* analyse syntaxique priorisant les && */

SEXPRESSION * analyse_recursive_expression_logique_et(char *bloc_prof)
  {
	  SEXPRESSION *gauche,*droite,*exp;
	  int operateur;

	  monte();

	  if(traceaff==1) printf("\n V %s analyse && ",affiche);

	  if(traceaff==1) printf("\n W %s  = %s",affiche,token);

	  gauche=analyse_recursive_expression_comparaison(bloc_prof);

	  if(traceaff==1) printf("\n X %s  = %s",affiche,token);

	  if((type_token==LCOMPET))
	 		{
				operateur=type_token;
				if(traceaff==1) printf("\n Y %s operateur = %s",affiche,token);
				cr=lire_token();
	  			if(cr==-1)
					 message_erreur(SX1260);
				if(traceaff==1) printf("\n Z %s  = %s",affiche,token);
				droite=analyse_recursive_expression_logique_et(bloc_prof);
			    if(traceaff==1) printf("\nAA %s  = %s",affiche,token);
				exp=nouvelle_expression(EXP_OPERATEUR,operateur,(char*)gauche,(char *)droite,0,NULL);
			}
	  else exp=gauche;

	  if(traceaff==1) printf("\nAB %s  = %s",affiche,token);

	  descend();

	  return(exp);
  }


/* analyse syntaxique priorisant les && */

SEXPRESSION * analyse_recursive_expression_logique_ou(char *bloc_prof)
  {
	  SEXPRESSION *gauche,*droite,*exp;
	  int operateur;

	  monte();

	  if(traceaff==1) printf("\nAC %s analyse || ",affiche);

	  if(traceaff==1) printf("\nAD %s  = %s",affiche,token);

	  gauche=analyse_recursive_expression_logique_et(bloc_prof);

	  if(traceaff==1) printf("\nAE %s  = %s",affiche,token);

	  if((type_token==LCOMPOU))
	 		{
				operateur=type_token;
				if(traceaff==1) printf("\nAF %s operateur = %s",affiche,token);
				cr=lire_token();
	  			if(cr==-1)
					 message_erreur(SX1270);
				if(traceaff==1) printf("\nAG %s  = %s",affiche,token);
				droite=analyse_recursive_expression_logique_ou(bloc_prof);
			    if(traceaff==1) printf("\nAH %s  = %s",affiche,token);
				exp=nouvelle_expression(EXP_OPERATEUR,operateur,(char*)gauche,(char *)droite,0,NULL);
			}
	  else exp=gauche;

	  if(traceaff==1) printf("\nAI %s  = %s",affiche,token);

	  descend();

	  return(exp);
  }

/* affichage récursif des expressions */

void affichage_recursif(SEXPRESSION *exp)
 {

	 char aff_op[100];
	 char aff_type[100];

	 monte();

	 if(exp==NULL)
		 {
		 	if(traceaff==1) printf("\n%s Feuille NULL ",affiche);
		 }
	 else
	 	switch(exp->type)
		  {
			  		case EXP_POINTEUR:
						{
							if(traceaff==1) printf("\n%s POINTEUR *( '%s' + index ) type = '%s'",
								affiche,
								exp->feuille.spointeur.ident_variable,
								exp->feuille.spointeur.variable_ptr->type_variable_ptr->type);

							if(exp->feuille.spointeur.index!=NULL)
								affichage_recursif(exp->feuille.spointeur.index);

						} break;
					case EXP_ATOME:
						{

							switch(exp->feuille.satome.type)
						 	 {
								 case LCHIFFREENT:
									 {
										 strcpy(aff_type,"ENTIER");
									 }break;
								 case LCHIFFRREEL:
									 {
										 strcpy(aff_type,"REEL");
									 }break;
								 case CHAINE:
									 {
										 strcpy(aff_type,"CHAINE");
									 }break;
								 case LIDENT:
									 {
										 strcpy(aff_type,"Ident");
									 }break;
							 }

							if(traceaff==1) printf("\n%s ATOME %s OP = %d TYPE = %d/%s ",
								affiche,
								exp->feuille.satome.valeur,
								exp->operateur,
								exp->feuille.satome.type,
								aff_type);

						}break;
					case EXP_VARIABLE:
						{
							int i;
							SVARIABLE *chaine;

							if(traceaff==1) printf("\n%s VARIABLE '%s'",
								affiche,
								exp->feuille.svariable.ident_variable);

							if(exp->feuille.svariable.indirection==TYP_PTR_VAR_ADRESSE) {if(traceaff==1) printf(" type ptr = '&' ");}
	 						if(exp->feuille.svariable.indirection==TYP_PTR_VAR_NORMAL) {if(traceaff==1) printf(" type ptr ='normal' ");}
	 						if(exp->feuille.svariable.indirection==TYP_PTR_VAR_POINTEUR) {if(traceaff==1) printf(" type ptr = '*' ");}
	 						if(exp->feuille.svariable.indirection==TYP_PTR_VAR_POINTEUR_POINTEUR) {if(traceaff==1) printf(" type ptr = '**' ");}

							if(traceaff==1) printf("\n%s ident '%s' bloc '%s' valeur '%s' / type '%s' ",
								affiche,
								exp->feuille.svariable.variable_ptr->ident ,
								exp->feuille.svariable.variable_ptr->bloc,
								exp->feuille.svariable.variable_ptr->valeur,
								exp->feuille.svariable.variable_ptr->type_variable_ptr->type);

							if(exp->feuille.svariable.variable_ptr->type_pointeur==POINTEUR)
								{if(traceaff==1) printf(" 'POINTEUR' ");}
							if(exp->feuille.svariable.variable_ptr->type_pointeur==PASPOINTEUR)
								{if(traceaff==1) printf(" 'PASPOINTEUR' ");}
							if(exp->feuille.svariable.variable_ptr->type_pointeur==POINTEURPOINTEUR)
								{if(traceaff==1) printf(" 'POINTEURPOINTEUR' ");}

							chaine=exp->feuille.svariable.suivant;

							for(;chaine!=NULL;)
								{
									switch(chaine->type_svariable)
										{
											case SVARIABLE_TABLEAU_SEUL :
												{
													int i;
													if(traceaff==1) printf("\n%s Tableau seul type '%s' ",affiche,chaine->type->type);
													for(i=0;i<chaine->nb_dimension;i++)
														{
															if(traceaff==1) printf("\n%s dimension '%d'",affiche,i);
															affichage_recursif(chaine->dimension[i]);
														}
												} break;
											case SVARIABLE_CHAMP_SEUL:
												{
													if(traceaff==1) printf("\n%s Champ seul ",affiche);
													if(traceaff==1) printf(" champ '%s' type '%s'",chaine->ident_champ,chaine->type->type);
													if(chaine->indirection==LPOINT) {if(traceaff==1) printf(" '.' ");}
													if(chaine->indirection==LINDIRECT) {if(traceaff==1) printf(" '->' ");}
												} break;
											case SVARIABLE_CHAMP_TABLEAU:
												{
													int i;
													if(traceaff==1) printf("\n%s Champ tableau ",affiche);
													if(traceaff==1) printf(" champ '%s' type '%s' ",chaine->ident_champ,chaine->type->type);
													/*if(chaine->indirection==LPOINT) printf(" '.' ");
													if(chaine->indirection==LINDIRECT) printf(" '->' ");*/
													for(i=0;i<chaine->nb_dimension;i++)
														{
															if(traceaff==1) printf("\n%s dimension '%d'",affiche,i);
															affichage_recursif(chaine->dimension[i]);
														}
												} break;
										}
									chaine=chaine->suivant;
								}

							/*for(i=0;i<exp->feuille.svariable.nb_dimension;i++)
								{
									printf("\n%s : dimension %d",affiche,i);
									affichage_recursif(exp->feuille.svariable.dimension[i]);
								}*/
						}break;
					case EXP_OPERATEUR:
						{
							switch(exp->operateur)
						 	 {
								 case LSHL:
									 {
										 strcpy(aff_op," '<<' ");
									 }break;
								 case LSHR:
									 {
										 strcpy(aff_op," '>>' ");
									 }break;
								 case LMUL:
									 {
										 strcpy(aff_op," '*' ");
									 }break;
								 case LDIV:
									 {
										 strcpy(aff_op," '/' ");
									 }break;
								 case LMODULO:
									 {
										 strcpy(aff_op," '%' ");
									 }break;
								 case LPLUS:
									 {
										 strcpy(aff_op," '+' ");
									 }break;
								 case LMOINS:
									 {
										 strcpy(aff_op," '-' ");
									 }break;
								 case LCOMPET:
									 {
										 strcpy(aff_op," '&&' ");
									 }break;
								 case LCOMPOU:
									 {
										 strcpy(aff_op," '||' ");
									 }break;
								 case LCOMPINF:
									 {
										 strcpy(aff_op," '<' ");
									 }break;
								 case LCOMPSUP:
									 {
										 strcpy(aff_op," '>' ");
									 }break;
								 case LCOMPINFEG:
									 {
										 strcpy(aff_op," '<=' ");
									 }break;
								 case LCOMPSUPEG:
									 {
										 strcpy(aff_op," '>=' ");
									 }break;
								 case LCOMPEG:
									 {
										 strcpy(aff_op," '==' ");
									 }break;
								 case LCOMPDIFF:
									 {
										 strcpy(aff_op," '!=' ");
									 }break;
								 case LOU:
									 {
										 strcpy(aff_op," '!' ");
									 }break;
								 case LET:
									 {
										 strcpy(aff_op," '&' ");
									 }break;
								 case LNON:
									 {
										 strcpy(aff_op," '!' ");
									 }break;
								 case LNEG:
									 {
										 strcpy(aff_op," '- unaire' ");
									 }break;
								 case LINC:
									 {
										 strcpy(aff_op," '++' ");
									 }break;
								 case LDEC:
									 {
										 strcpy(aff_op," '--' ");
									 }break;
							 }
							if(traceaff==1) printf("\n%s OPERATEUR %d/%s",affiche,exp->operateur,aff_op);
							affichage_recursif(exp->gauche);
							affichage_recursif(exp->droit);
						}break;
					case EXP_FONCTION:
						{
							int i;
							if(traceaff==1) printf("\n%s FONCTION %s nb ARG = %d",
								affiche,
								exp->feuille.sfonction.fonction,
								exp->feuille.sfonction.nb_argument);
							for(i=0;i<exp->feuille.sfonction.nb_argument;i++)
								{
									if(traceaff==1) printf("\n%s : argument %d",affiche,i);
									affichage_recursif(exp->feuille.sfonction.argument_ptr[i]);
								}
						}break;
		  }

	descend();
 }




SEXPRESSION * analyse_expression(char *bloc_prof)
  {
	  SEXPRESSION *exp;

	  monte();

	  if(traceaff==1) printf("\n%s ANALYSE expression token = %s",affiche,token);

	  /*cr=lire_token();
	  if(cr==-1)
		 message_erreur("\n Erreur Fatale : fin prématuré du fichier source dans l'expression ");*/


	  if(type_token==LCL)
		  {
	  		 if(traceaff==1) printf("\n%s expression = vide ()",affiche);
			 exp=NULL;
		  }/*
	  else if (type_token==LPV)
		  {
			  printf("\n%s expression = vide for(aff;;aff)",affiche);
			  exp=NULL;
		  }*/
	  else
		 {
			 if(traceaff==1) printf("\n%s expression = %s",affiche,token);
			 exp=analyse_recursive_expression_logique_ou(bloc_prof);
         }

	  descend();

	  if(traceaff==1) printf("\n%s +++++++++++++++++ CONTROLE EXPRESSION ++++++++++++++++++ ",affiche);
	  affichage_recursif(exp);
	  if(traceaff==1) printf("\n%s +++++++++++++++++ CONTROLE EXPRESSION ++++++++++++++++++ ",affiche);

	  return(exp);
  }

  /*
#define AFF_EXP  0
#define AFF_INC  1
#define AFF_DEC  2

#define SAFFECTATION struct saffectation
SAFFECTATION {
	SEXPRESSION *variable;
	SEXPRESSION *valeur_affectee;
	int type_affectation;
};*/

/* Analyse de l'affectation, incrément ou décrément */

SAFFECTATION * analyse_affectation(char *bloc_prof,int type_pointeur_var)
  {
	  char nom_variable[MAX_IDENT];
	  SEXPRESSION *exp,*exp_var;
	  SAFFECTATION *affectation;
	  int index;
	  int type;

	  monte();

	  index=recherche_variable(token,bloc_prof);

	  strcpy(nom_variable,token);

	  if(traceaff==1) printf("\n%s VARIABLE = %s : %d",affiche,nom_variable,index);


	  exp_var=analyse_synt_variable(bloc_prof,type_pointeur_var);

	 if(traceaff==1) printf("\n%s +++++++++++++++++ CONTROLE VARIABLE AFFECTEE ++++++++++++++++++ ",affiche);
	 affichage_recursif(exp_var);
	 if(traceaff==1) printf("\n%s +++++++++++++++++ CONTROLE VARIABLE AFFECTEE ++++++++++++++++++ ",affiche);


	  cr=lire_token();
	  if(cr==-1)
		 message_erreur(SX1280);


	 if(type_token==LINC) /* cas de l'increment */
		 {
			 type=AFF_INC;
			 exp=NULL;

			 if(traceaff==1) printf("\n%s INCREMENT DETECTE",affiche);

			 /* on se positionne sur le ; */
			 cr=lire_token();
	  		 if(cr==-1)
		  		message_erreur(SX1290);

		 }
	 else if(type_token==LDEC) /* cas du decrement */
	     {
			 type=AFF_DEC;
			 exp=NULL;

			 if(traceaff==1) printf("\n%s DECREMENT DETECTE",affiche);

			 /* on se positionne sur le ; */
			 cr=lire_token();
	  		 if(cr==-1)
		  		message_erreur(SX1300);
	     }
	 else /* cas de l'affectation */
		 {
			 if(type_token!=LEG)
		 			message_erreur(SX1310);

			 if(traceaff==1) printf("\n%s AFFECTATION EXPRESSION DETECTE",affiche);

      		 if(traceaff==1) printf("\n%s Consommation du = ",affiche);

	  		 cr=lire_token();
	 	     if(cr==-1)
		 		message_erreur(SX1320);

			 if(type_token==LCL)
			  	message_erreur(SX1330);

			 if(type_token==LPV)
			  	message_erreur(SX1340);

			 /* analyse de l'expression affectee */

	 		 exp=analyse_expression(bloc_prof); /* l'expression peut être vide  */

	 		if(traceaff==1) printf("\n%s +++++++++++++++++ CONTROLE EXPRESSION AFFECTEE ++++++++++++++++++ ",affiche);
	 		affichage_recursif(exp);
	 		if(traceaff==1) printf("\n%s +++++++++++++++++ CONTROLE EXPRESSION AFFECTEE ++++++++++++++++++ ",affiche);

			type=AFF_EXP;
		}

	 affectation=(SAFFECTATION *)malloc(sizeof(SAFFECTATION));

	 if(affectation==NULL)
		 message_erreur(SX1350);

	 affectation->variable=exp_var;
	 affectation->valeur_affectee=exp;
	 affectation->type_affectation=type;

	 descend();

	 return(affectation);
  }

 INSTRUCTION * analyse_liste_instruction(char *,int);


 /* affiche recursivement les instructions */

void affiche_inst_if(INSTRUCTION *);
void affiche_inst_for(INSTRUCTION *);
void affiche_inst_do_while(INSTRUCTION *);


void affichage_instruction(INSTRUCTION *inst)
  {

	  monte();

	  if(inst==NULL)
	   {
			  if(traceaff==1) printf("\n%s FEUILLE ",affiche);
       }
	  else
	   {

		   if(traceaff==1) printf("\n%s Index instruction =%d %s", affiche,((char *)inst-(char *)&tab_instruction[0])/sizeof(INSTRUCTION),inst->bloc);

		   switch(inst->type_instruction)
		     {

			    case INST_ARRSIZE:
					{
							/* char  label[MAX_IDENT];
							   char  size[MAX_IDENT];*/

	 						if(traceaff==1) printf("\n%s__________________________________________________________________________________",affiche);
							if(traceaff==1) printf("\n%s INSTRUCTION ARRSIZE TAB='%s' SIZE='%s'", affiche,
												inst->instruction.sarrsize.label,
												inst->instruction.sarrsize.size);
	 						if(traceaff==1) printf("\n%s__________________________________________________________________________________",affiche);
					}break;
				case INST_ARRINIT:
					{
							SEXPRESSION *expression_value_ptr;
							SEXPRESSION *expression_size_ptr;


	 						expression_value_ptr=inst->instruction.sarrinit.expression_value_ptr;
							expression_size_ptr=inst->instruction.sarrinit.expression_size_ptr;

	 						if(traceaff==1) printf("\n%s__________________________________________________________________________________",affiche);
							if(traceaff==1) printf("\n%s INSTRUCTION ARRINIT TAB='%s' ", affiche,
												inst->instruction.sarrinit.label);

							if(traceaff==1) printf("\n%s EXPR VALUE ", affiche);
	 						affichage_recursif(expression_value_ptr);

							if(traceaff==1) printf("\n%s EXPR SIZE ", affiche);
	 						affichage_recursif(expression_size_ptr);

	 						if(traceaff==1) printf("\n%s__________________________________________________________________________________",affiche);
					}break;
				case INST_ARRSUBSET:
					{

							SEXPRESSION *expression_index_ptr;
							SEXPRESSION *expression_length_ptr;

							expression_index_ptr=inst->instruction.sarrsubset.expression_index_ptr;
							expression_length_ptr=inst->instruction.sarrsubset.expression_length_ptr;

	 						if(traceaff==1) printf("\n%s__________________________________________________________________________________",affiche);
							if(traceaff==1) printf("\n%s INSTRUCTION ARRSUBSET TAB SRC='%s' TAB DST='%s' ", affiche,
												inst->instruction.sarrsubset.label_src,
												inst->instruction.sarrsubset.label_dst);

							if(traceaff==1) printf("\n%s EXPR INDEX ", affiche);
	 						affichage_recursif(expression_index_ptr);

							if(traceaff==1) printf("\n%s EXPR LENGTH ", affiche);
	 						affichage_recursif(expression_length_ptr);

	 						if(traceaff==1) printf("\n%s__________________________________________________________________________________",affiche);
					}break;
				case INST_ARRBUILD:
					{
							int i;

							 /* int 	nb_tab;
								char    *label[10]; */

							if(traceaff==1) printf("\n%s__________________________________________________________________________________",affiche);
							if(traceaff==1) printf("\n%s INSTRUCTION ARRBUILD ", affiche);

							for(i=0;i<inst->instruction.sarrbuild.nb_tab;i++)
									printf(" %s ",inst->instruction.sarrbuild.label[i]);

	 						if(traceaff==1) printf("\n%s__________________________________________________________________________________",affiche);
					}break;

				case INST_INLINE :
					{
							 if(traceaff==1) printf("\n%s INSTRUCTION INLINE '%s' ", affiche,inst->instruction.sinline);
					}break;
				case INST_ACQUIRE :
					{
							 if(traceaff==1) printf("\n%s INSTRUCTION ACQUIRE '%s' ", affiche,inst->instruction.smutex_acquire);
					}break;
				case INST_RELEASE :
					{
							 if(traceaff==1) printf("\n%s INSTRUCTION RELEASE '%s' ", affiche,inst->instruction.smutex_release);
					}break;
				case INST_IF :
					{
							 if(traceaff==1) printf("\n%s INSTRUCTION IF ", affiche);
							 affiche_inst_if(inst);
					}break;
				case INST_FOR :
					{
						 	 if(traceaff==1) printf("\n%s INSTRUCTION FOR ", affiche);
							 affiche_inst_for(inst);
					}break;
				case INST_DO_REPEAT :
					{
							if(traceaff==1) printf("\n%s DO REPEAT ", affiche);
							affiche_inst_do_while(inst);
					}break;
				case INST_SWITCH :
					{
						int i;

						if(traceaff==1) printf("\n%s__________________________________________________________________________________",affiche);
						if(traceaff==1) printf("\n%s INSTRUCTION SWITCH ",affiche);
						if(traceaff==1) printf("\n%s INSTRUCTION EXPRESSION ",affiche);
						affichage_recursif(inst->instruction.sswitch.expression);
						for(i=0;i<inst->instruction.sswitch.nb_case;i++)
		 				 {
							monte();

							if(traceaff==1) printf("\n%s case/default %d",affiche,i);

							if(inst->instruction.sswitch.type_case[i]==TYPE_CASE_CASE)
								{
									if(traceaff==1) printf("\n%s CASE ",affiche);
								}
							else
								{
									if(traceaff==1) printf("\n%s DEFAULT ",affiche);
								}

							monte();

							if(inst->instruction.sswitch.expression_case[i]==NULL)
								{
									if(traceaff==1) printf("\n%s EXPRESSION VIDE",affiche);
							    }
							else
								affichage_recursif(inst->instruction.sswitch.expression_case[i]);

							descend();

							if(inst->instruction.sswitch.cases[i]==NULL)
								{
									if(traceaff==1) printf("\n%s INSTRUCTION VIDE",affiche);
								}
							else
								affichage_instruction(inst->instruction.sswitch.cases[i]);

	  						if(inst->instruction.sswitch.break_or_not[i]==1)
								 {
									if(traceaff==1) printf("\n%s BREAK",affiche);
								 }
							else
								if(traceaff==1) printf("\n%s PAS DE BREAK",affiche);

							descend();
						 }
						if(inst->instruction.sswitch.nb_case==0)  {if(traceaff==1) printf("\n%s CORPS SWITCH VIDE ",affiche);}
	 					if(traceaff==1) printf("\n%s__________________________________________________________________________________",affiche);

					}break;
				case INST_LABEL :
					{
							if(traceaff==1) printf("\n%s INSTRUCTION LABEL '%s' ", affiche,inst->instruction.slabel);
					}break;
				case INST_GOTO :
					{
							if(traceaff==1) printf("\n%s INSTRUCTION GOTO '%s'", affiche,inst->instruction.sgoto);
					}break;
				case INST_RETURN :
					{
							SEXPRESSION *exp;
							int type;

	 						exp=inst->instruction.sreturn.expression_ptr;
							type=inst->instruction.sreturn.exp;

	 						if(traceaff==1) printf("\n%s__________________________________________________________________________________",affiche);
							if(traceaff==1) printf("\n%s INSTRUCTION RETURN ",affiche);
							if(type==1)
	 							affichage_recursif(exp);
							else {if(traceaff==1) printf("\n%s  RETURN VIDE ",affiche);}
	 						if(traceaff==1) printf("\n%s__________________________________________________________________________________",affiche);

					}break;
				case INST_BREAK	:
					{
						monte();
							if(traceaff==1) printf("\n%s INSTRUCTION BREAK ", affiche);
						descend();
					}break;
				case INST_CASE :
					{
							if(traceaff==1) printf("\n%s INSTRUCTION CASE ", affiche);
					}break;
				case INST_CONTINUE :
					{
						monte();
							if(traceaff==1) printf("\n%s INSTRUCTION CONTINUE ", affiche);
						descend();
					}break;
				case INST_EXIT:
					{
						monte();
							if(traceaff==1) printf("\n%s INSTRUCTION EXIT ", affiche);
						descend();
					}break;
				case INST_PRECEDES:
					{
						int i;
						monte();
	 						if(traceaff==1) printf("\n%s__________________________________________________________________________________",affiche);
							if(traceaff==1) printf("\n%s INSTRUCTION PRECEDES ",affiche);

							for(i=0;i<inst->instruction.sprecedes.nb_label;i++)
								{
									if(traceaff==1) printf("\n%s tache = '%s' ",affiche,&inst->instruction.sprecedes.label[i][0]);
								}

	 						if(traceaff==1) printf("\n%s__________________________________________________________________________________",affiche);
						descend();
					}break;
				case INST_AFFECTATION :
					{
						monte();
							if(traceaff==1) printf("\n%s INSTRUCTION AFFECTATION %lx %lx",
								affiche,
								inst->instruction.saffectation->variable,
								inst->instruction.saffectation->valeur_affectee);

							affichage_recursif(inst->instruction.saffectation->variable);

							if(inst->instruction.saffectation->type_affectation==AFF_PTR)
								{
									if(traceaff==1) printf("\n%s (indirection) = ",affiche);
									affichage_recursif(inst->instruction.saffectation->valeur_affectee);
								}
							else
							if(inst->instruction.saffectation->type_affectation==AFF_EXP)
								{
									if(traceaff==1) printf("\n%s (variable simple) = ",affiche);
									affichage_recursif(inst->instruction.saffectation->valeur_affectee);
								}
							else if(inst->instruction.saffectation->type_affectation==AFF_INC)
								{
									if(traceaff==1) printf("\n%s ++ INCREMENTATION ",affiche);
								}
							else if(inst->instruction.saffectation->type_affectation==AFF_DEC)
								{
									if(traceaff==1) printf("\n%s -- DECREMENTATION ",affiche);
								}

						descend();
					}break;
				/*case INST_EXPRESSION :
					{
					}break;*/
				case INST_FONCTION :
					{
						monte();
							if(traceaff==1) printf("\n%s INSTRUCTION FONCTION ", affiche);

							affichage_recursif(inst->instruction.sfonction);
						descend();
					}break;
				case INST_BLOC :
					{
							int i;

							if(traceaff==1) printf("\n%s INSTRUCTION BLOC ", affiche);

							monte();

							if(inst->instruction.sbloc.nb_instruction==0)
								{
									if(traceaff==1) printf("\n%s BLOC VIDE ", affiche);
							    }
							else
								{
									if(traceaff==1) printf("\n%s LISTE INSTRUCTION BLOC nb_inst %d", affiche,inst->instruction.sbloc.nb_instruction);

									for(i=0;i< inst->instruction.sbloc.nb_instruction;i++)
									{
										if(traceaff==1) printf("\n%s SOUS INSTRUCTION BLOC %d", affiche,i);
										affichage_instruction(inst->instruction.sbloc.liste_instruction[i]);
									}
								}

							descend();
					}break;
		     }
	   }

	  descend();
  }


 /* affiche les for */

void affiche_inst_if(INSTRUCTION *inst)
 {
	 SEXPRESSION *exp;
	 INSTRUCTION *inst_then,*inst_else,*inst_r;
	 int type_if;

	 monte();

	 exp=inst->instruction.sif.argument;
	 inst_then=inst->instruction.sif.corps_if;
	 inst_else=inst->instruction.sif.corps_else;
	 type_if=inst->instruction.sif.selse;

	 if(traceaff==1) printf("\n%s__________________________________________________________________________________",affiche);

	 if(traceaff==1) printf("\n%s INSTRUCTION IF ", affiche);

	 affichage_recursif(exp);

	 if(traceaff==1) printf("\n%s THEN ",affiche);

	 affichage_instruction(inst_then);

	 if(type_if==1)
		 {
				if(traceaff==1) printf("\n%s ELSE", affiche);

	 			affichage_instruction(inst_else);
		 }
	 else { if(traceaff==1) printf("\n%s PAS DE ELSE ",affiche); }

	 if(traceaff==1) printf("\n%s__________________________________________________________________________________",affiche);

	 descend();
 }


 /* analyse les if, else */

INSTRUCTION * analyse_if(char *bloc_prof)
  {
	  SEXPRESSION *exp;
	  INSTRUCTION *inst_then;
	  INSTRUCTION *inst_else;
	  INSTRUCTION *inst_r;
	  int type_if;

	  type_if=0;

	  monte();

	  if(traceaff==1) printf("\n%s : if (token constatee =%s)",affiche,token);

	  cr=lire_token();
	  if(cr==-1)
		 message_erreur(SX1360);

	 if(traceaff==1) printf("\n%s : token lu apres le if =%s)",affiche,token);

	 if(type_token!=LOP)
		 message_erreur(SX1370);

	 cr=lire_token();
	 if(cr==-1)
		 message_erreur(SX1380);

	 exp=analyse_expression(bloc_prof); /* l'expression peut être vide çad if () */

	/* cr=lire_token();
	 if(cr==-1)
		 message_erreur("\n Erreur Fatale : fin prématuré du fichier source dans l'instruction if  ");*/

	  if(type_token!=LCL)
		message_erreur(SX1390);

	  cr=lire_token();
	  if(cr==-1)
		 message_erreur(SX1400);

	  inst_then=analyse_liste_instruction(bloc_prof,1);

	 /* cr=lire_token();
	  if(cr==-1)
		 message_erreur("\n Erreur Fatale : fin prématuré du fichier source dans l'instruction if  ");*/

	  if(traceaff==1) printf("\n%s : y-a-t-il un else: %s",affiche,token);

	  if(type_token==LELSE)
		  {
		      		if(traceaff==1) printf("\n%s : debut::else",affiche);

			  		cr=lire_token();
	  		  		if(cr==-1)
				  		message_erreur(SX1410);

			  		inst_else=analyse_liste_instruction(bloc_prof,1);

					type_if=1;
		 }
	  else inst_else=NULL;

	  inst_r=(INSTRUCTION *)nouvelle_instruction(bloc_prof,INST_IF,type_if,exp,inst_then,inst_else,NULL,NULL,NULL,0,NULL,NULL,NULL,NULL);

	  affiche_inst_if(inst_r);

	  /*sleep(90000);*/

	  descend();

	  return(inst_r);
  }


 /* affiche les for */

void affiche_inst_for(INSTRUCTION *inst)
 {
	 SEXPRESSION *exp1;
	 SAFFECTATION *aff1,*aff2;
	 INSTRUCTION *inst_r;

	 monte();

	 aff1=inst->instruction.sfor.argument_init_ptr;
	 exp1=inst->instruction.sfor.expression_ptr;
	 aff2=inst->instruction.sfor.argument_increment_ptr;
	 inst_r=inst->instruction.sfor.corps_for;

	 if(traceaff==1) printf("\n%s__________________________________________________________________________________",affiche);
	 if(traceaff==1) printf("\n%s INSTRUCTION FOR(AFF1;EXP;AFF2)LISTINST ", affiche);

  if(aff1!=NULL)
   {
	 affichage_recursif(aff1->variable);
	 if(aff1->type_affectation==AFF_EXP)
	   {
	 		if(traceaff==1) printf("\n%s = ",affiche);
	 		affichage_recursif(aff1->valeur_affectee);
	   }
	 else if(aff1->type_affectation==AFF_INC)
		 {
		 	if(traceaff==1) printf("\n%s ++ INCREMENT ",affiche);
		 }
	 else if(aff1->type_affectation==AFF_DEC)
		 {
		 	if(traceaff==1) printf("\n%s -- DECREMENT ",affiche);
		 }
   }
  else
   {
	   	if(traceaff==1) printf("\n%s AFF1 VIDE ",affiche);
   }

  if(exp1!=NULL)
   {
	 affichage_recursif(exp1);
   }
  else
   {
	    if(traceaff==1) printf("\n%s EXP VIDE ",affiche);
   }

  if(aff2!=NULL)
   {
	 affichage_recursif(aff2->variable);
	 if(aff2->type_affectation==AFF_EXP)
	   {
	 		if(traceaff==1) printf("\n%s = ",affiche);
	 		affichage_recursif(aff2->valeur_affectee);
	   }
	 else if(aff2->type_affectation==AFF_INC)
		 {
		 	if(traceaff==1) printf("\n%s ++ INCREMENT ",affiche);
		 }
	 else if(aff2->type_affectation==AFF_DEC)
		 {
		 	if(traceaff==1) printf("\n%s -- DECREMENT ",affiche);
		 }
   }
  else
   {
	     if(traceaff==1) printf("\n%s AFF2 VIDE ",affiche);
   }

	 affichage_instruction(inst_r);

	 if(traceaff==1) printf("\n%s__________________________________________________________________________________",affiche);

	 descend();
 }

 /* analyse les for */

INSTRUCTION * analyse_for(char *bloc_prof)
  {
	  SEXPRESSION *exp1;
	  SAFFECTATION *aff1,*aff2;
	  INSTRUCTION *inst;
	  INSTRUCTION  *inst_r;
	  /*SFOR *sfor;*/

	  monte();
	  boucle++;

	  if(traceaff==1) printf("\n%s : for (token constatee =%s;;)",affiche,token);

	  /* consommation du ( */
	  cr=lire_token();
	  if(cr==-1)
		 message_erreur(SX1420);

	 if(traceaff==1) printf("\n%s : token lu apres le for =%s",affiche,token);

	 if(type_token!=LOP)
		 message_erreur(SX1430);

	 /* analyse de l'affectation du for(xxx;;) */

	 cr=lire_token();
	 if(cr==-1)
		 message_erreur(SX1440"\n Erreur Fatale #S0131 : fin prématuré du fichier source dans l'instruction for(;;)  ");

	 if(type_token!=LPV)
		 {
			 int type_pointeur_var;

	  		 type_pointeur_var=TYP_PTR_VAR_NORMAL;

	  		 if(type_token==LMUL)
				{
					if(traceaff==1) printf("\n X %s * detectee",affiche);
					cr=lire_token();
	   				if(cr==-1)
		 				message_erreur(SX1450);
					type_pointeur_var=TYP_PTR_VAR_POINTEUR;
					if(type_token==LMUL)
						{
							if(traceaff==1) printf("\n Z %s ** detectee",affiche);
							cr=lire_token();
	   			 		  	if(cr==-1)
		 						message_erreur(SX1460);
							type_pointeur_var=TYP_PTR_VAR_POINTEUR_POINTEUR;
						}
				}
	 		aff1=analyse_affectation(bloc_prof,type_pointeur_var);
		 } /* patch 15/04/07 */
	 else aff1=NULL;

	 if(type_token!=LPV)
		 message_erreur(SX1470);

	   /* consommation du ; */
	  cr=lire_token();
	  if(cr==-1)
		 message_erreur(SX1480);

	 /* analyse de l'affectation du for(;xxx;) */
	 if(type_token!=LPV)
	 	exp1=analyse_expression(bloc_prof); /* l'expression peut être vide  */
     /* patch 15/04/07 */
	 else exp1=NULL;

	 if(type_token!=LPV)
		 message_erreur(SX1490);

	  /* consommation du ; */
	  cr=lire_token();
	  if(cr==-1)
		 message_erreur(SX1500);

	 /* analyse de l'affectation du for(;;xxx) */

	 if(type_token!=LCL)
		 {
			 int type_pointeur_var;

	  		 type_pointeur_var=TYP_PTR_VAR_NORMAL;

	  		 if(type_token==LMUL)
				{
					if(traceaff==1) printf("\n X %s * detectee",affiche);
					cr=lire_token();
	   				if(cr==-1)
		 				message_erreur(SX1510);
					type_pointeur_var=TYP_PTR_VAR_POINTEUR;
					if(type_token==LMUL)
						{
							if(traceaff==1) printf("\n Z %s ** detectee",affiche);
							cr=lire_token();
	   			 		  	if(cr==-1)
		 						message_erreur(SX1520);
							type_pointeur_var=TYP_PTR_VAR_POINTEUR_POINTEUR;
						}
				}

	 		 aff2=analyse_affectation(bloc_prof,type_pointeur_var);
		 } /* patch 15/04/07 */
	 else aff2=NULL;

	 if(type_token!=LCL)
		 message_erreur(SX1530);

	 cr=lire_token();
	  if(cr==-1)
		 message_erreur(SX1540);

	 /* analyse du corps du for */

	 inst=(INSTRUCTION *)analyse_liste_instruction(bloc_prof,1);

	 /* analyse du corps du for */

	 descend();

	 inst_r=(INSTRUCTION *)nouvelle_instruction(bloc_prof,INST_FOR,0,exp1,inst,NULL,aff1,aff2,NULL,0,NULL,NULL,NULL,NULL);

	/* affiche_inst_for(inst_r);*/

	boucle--;

	return(inst_r);

  }



/* affiche les do while */

void affiche_inst_do_while(INSTRUCTION *inst)
 {
	 SEXPRESSION *exp;
	 INSTRUCTION *inst_r;

	 monte();

	 exp=inst->instruction.sdo_repeat.expression_ptr;
	 inst_r=inst->instruction.sdo_repeat.corps;

	 if(traceaff==1) printf("\n%s__________________________________________________________________________________",affiche);

	 if(traceaff==1) printf("\n%s INSTRUCTION DO LISTEINST WHILE(EXP) ", affiche);

	 if(traceaff==1) printf("\n%s CORPS ",affiche);
	 affichage_instruction(inst_r);

	 if(exp!=NULL)
		 {
	 		if(traceaff==1) printf("\n%s EXPRESSION ",affiche);
	 		affichage_recursif(exp);
		 }
	 else
			{ if(traceaff==1) printf("\n%s EXPRESSION VIDE ",affiche); }

	 if(traceaff==1) printf("\n%s__________________________________________________________________________________",affiche);

	 descend();
 }


 /* analyse les do while */

INSTRUCTION * analyse_do_while(char *bloc_prof)
  {
	  SEXPRESSION *exp;
	  INSTRUCTION  *inst_r,*inst;

	  if(traceaff==1) printf("\n%s : do while",affiche);

	  boucle++;

	  monte();


	  /* on consomme le do */
	  cr=lire_token();
	  if(cr==-1)
		 message_erreur(SX1550);

	  if(traceaff==1) printf("\n%s A : do while token courant=%s",affiche,token);


	  /* analyse du corps du do while */

	  if(type_token!=LWHILE)
	  	inst=(INSTRUCTION *)analyse_liste_instruction(bloc_prof,1);
	  else inst=NULL;

	  if(type_token!=LWHILE)
		 message_erreur(SX1560);

	  /* on consomme le while */
	  cr=lire_token();
	  if(cr==-1)
		 message_erreur(SX1570);

      if(traceaff==1) printf("\n%s B : do while token courant=%s",affiche,token);

	 /* analyse de l'affectation du do repeat(xxx); */
	 if(type_token!=LOP)
		  message_erreur(SX1580);

	 /* on consomme la ( */
	 cr=lire_token();
	 if(cr==-1)
		 message_erreur(SX1590);

	 if(traceaff==1) printf("\n%s C : do while token courant=%s",affiche,token);

	 if(type_token!=LCL)
	 	{
			exp=analyse_expression(bloc_prof); /* l'expression peut être vide  */
	    }
	 else exp=NULL;

	 if(traceaff==1) printf("\n%s D : do while token courant=%s",affiche,token);

	 if(type_token!=LCL)
   		 message_erreur(SX1600);

	 /* on consomme la ) */

	 cr=lire_token();
	 if(cr==-1)
		 message_erreur(SX1610);

	 if(traceaff==1) printf("\n%s E : do while token courant=%s",affiche,token);

	 if(type_token!=LPV)
		 message_erreur(SX1620);

	 /* on consomme le ; */

	 cr=lire_token();
	 if(cr==-1)
		 message_erreur(SX1630);

  	 if(traceaff==1) printf("\n%s F : do while token courant=%s",affiche,token);

	 descend();

	 boucle--;

	 inst_r=(INSTRUCTION *)nouvelle_instruction(bloc_prof,INST_DO_REPEAT,0,exp,inst,NULL,NULL,NULL,NULL,0,NULL,NULL,NULL,NULL);

	 return(inst_r);
  }


 /* analyse les goto */

 void analyse_goto(char *bloc_prof)
  {
	  char label[MAX_IDENT];

	  monte();

	  if(traceaff==1) printf("\n%s : goto",affiche);

	  /* on consomme le goto */

	  cr=lire_token();
	  if(cr==-1)
		 message_erreur(SX1640);

	  if(type_token==LIDENT)
	   {
			strcpy(label,token);

			if(traceaff==1) printf("\n%s Label = '%s' analysé",affiche,label);

			/* on se positionne sur ; */

			cr=lire_token();
	  		if(cr==-1)
		 		message_erreur(SX1650);

			if(type_token!=LPV)
				message_erreur(SX1660);

 			nouvelle_instruction(bloc_prof,INST_GOTO,0,NULL,NULL,NULL,NULL,NULL,NULL,0,NULL,NULL,NULL,label);

			/* on consomme le ; */

			cr=lire_token();
	  		if(cr==-1)
		 		message_erreur(SX1670);
	   }
	  else
		message_erreur(SX1680);

	  descend();
  }


 /* analyse les return */

INSTRUCTION * analyse_return(char *bloc_prof)
  {

	  INSTRUCTION *r_inst;
	  SEXPRESSION *exp;
	  int type;

	  monte();

	  if(traceaff==1) printf("\n%s :DEBUT return token=%s",affiche,token);

	  if(flag_return==0)
		   message_erreur(SX1690);

	  /* consommation du ( */
	  cr=lire_token();
	  if(cr==-1)
		 message_erreur(SX1700);

	 /* analyse de l'affectation du for(;xxx;) */
	 if(type_token!=LOP)
	 	 message_erreur(SX1710);

	  /* consommation sur exp après ( */
	  cr=lire_token();
	  if(cr==-1)
		 message_erreur(SX1720);

	 /* analyse de l'expression du return(xxx) */

	 if(type_token!=LCL)
		 {
	 		exp=analyse_expression(bloc_prof); /* l'expression peut être vide  */
			type=1;
		 }
	 else type=0;

 	 if(traceaff==1) printf("\n%s :APS EXP return token=%s",affiche,token);

	 if(type_token!=LCL)
		 message_erreur(SX1730);

	 /* consommation du ; */
	 cr=lire_token();
	 if(cr==-1)
		 message_erreur(SX1740);

	 r_inst=(INSTRUCTION*)nouvelle_instruction(bloc_prof,INST_RETURN,type,exp,NULL,NULL,NULL,NULL,
									NULL,0,NULL,NULL,NULL,NULL);

	  /* on lit le token suivant */
	  cr=lire_token();
	  if(cr==-1)
		 message_erreur(SX1750);

	 if(traceaff==1) printf("\n%s :FIN return token=%s",affiche,token);

	 descend();

	 return(r_inst);
  }

  /* analyse les break */

 INSTRUCTION * analyse_break(char *bloc_prof)
  {
	  INSTRUCTION *r_inst;

	  monte();

	  if(traceaff==1) printf("\n%s :DEBUT break token=%s",affiche,token);

	  if(boucle==0)
		   message_erreur(SX1760);

	  /* consommation du ; */
	  cr=lire_token();
	  if(cr==-1)
		 message_erreur(SX1765);

	 /* analyse de l'affectation du for(;xxx;) */
	 if(type_token!=LPV)
	 	 message_erreur(SX1770);


	 r_inst=(INSTRUCTION*)nouvelle_instruction(bloc_prof,INST_BREAK,0,NULL,NULL,NULL,NULL,NULL,
									NULL,0,NULL,NULL,NULL,NULL);

	  /* on lit le token suivant */
	  cr=lire_token();
	  if(cr==-1)
		 message_erreur(SX1780);

	 if(traceaff==1) printf("\n%s :FIN break token=%s",affiche,token);

	 descend();

	 return(r_inst);
  }

  /* analyse les return */

 INSTRUCTION *  analyse_continue(char *bloc_prof)
  {
	  INSTRUCTION *r_inst;

	  monte();

	  if(traceaff==1) printf("\n%s :DEBUT continue token=%s",affiche,token);

	  if(boucle==0)
		   message_erreur(SX1790);

	  /* consommation du ; */
	  cr=lire_token();
	  if(cr==-1)
		 message_erreur(SX1800);

	 /* analyse de l'affectation du for(;xxx;) */
	 if(type_token!=LPV)
	 	 message_erreur(SX1810);


	 r_inst=(INSTRUCTION*)nouvelle_instruction(bloc_prof,INST_CONTINUE,0,NULL,NULL,NULL,NULL,NULL,
									NULL,0,NULL,NULL,NULL,NULL);

	  /* on lit le token suivant */
	 cr=lire_token();
	 if(cr==-1)
		 message_erreur(SX1820);

	 if(traceaff==1) printf("\n%s :FIN continue token=%s",affiche,token);


	 descend();

	 return(r_inst);
  }

 /* analyse les return */


/*
#define TYPE_CASE_CASE 1
#define TYPE_CASE_DEFAULT 2
#define MAX_CASE 100
#define SSWITCH struct sswitch
SSWITCH {
	SEXPRESSION *expression;
	SEXPRESSION *expression_case[MAX_CASE];
	INSTRUCTION *cases[MAX_CASE];
	int nb_case;
	int type_case[MAX_CASE];
	int break_or_not[MAX_CASE];
};*/


INSTRUCTION * analyse_switch(char *bloc_prof)
  {
	  SEXPRESSION *expression;
	  SEXPRESSION *expression_case[MAX_CASE];
	  INSTRUCTION *cases[MAX_CASE],*r_inst;
	  int nb_case;
	  int type_case[MAX_CASE];
	  int break_or_not[MAX_CASE];
	  int i;

	  monte();

	  if(traceaff==1) printf("\n%s : switch",affiche);


	  /* consomme le switch */
	  cr=lire_token();
	  if(cr==-1)
		 message_erreur(SX1830);

	  /* lit l'expression */

	  expression=analyse_expression(bloc_prof);

	  if(type_token!=LBEGIN)
		 message_erreur(SX1840);

	 nb_case=0;

	 cr=lire_token();
	 if(cr==-1)
		 message_erreur(SX1850);

	 for(;;)
		{

			monte();

			if(traceaff==1) printf("\n%s A Case %d token courant = %s",affiche,nb_case,token);

			if(type_token==LEND)
				break;

			if((type_token!=LCASE)&&(type_token!=LDEFAULT))
				message_erreur(SX1855);

			if(type_token==LCASE)
			  	{

					    type_case[nb_case]=TYPE_CASE_CASE;
						/* on consomme le case */
	  					cr=lire_token();
	  					if(cr==-1)
		 					message_erreur(SX1857);

						if(traceaff==1) printf("\n%s B Case %d token courant = %s",affiche,nb_case,token);

						/* lit l'expression */

	  					expression_case[nb_case]=analyse_expression(bloc_prof);

						if(traceaff==1) printf("\n%s C Case %d token courant = %s",affiche,nb_case,token);

				}
			else /* default */
				{
						type_case[nb_case]=TYPE_CASE_DEFAULT;

						expression_case[nb_case]=NULL;

						/* on consomme le case */
	  					cr=lire_token();
	  					if(cr==-1)
		 					message_erreur(SX1860);

						if(traceaff==1) printf("\n%s D Case %d token courant = %s",affiche,nb_case,token);
				}

			if(type_token!=LDP)
				message_erreur(SX1870);


			/* on consomme le ':' */
			cr=lire_token();
	  		if(cr==-1)
		 		message_erreur(SX1880);

			if(traceaff==1) printf("\n%s E Case %d token courant = %s",affiche,nb_case,token);

			if(type_token==LBREAK) /* un break; et c'est tout */
				{
					 if(traceaff==1) printf("\n%s break detecté ",affiche);
					 cases[nb_case]=NULL;
					 break_or_not[nb_case]=1;

					 /* on consomme le break; */
					cr=lire_token();
	  				if(cr==-1)
		 				message_erreur(SX1890);

					if(traceaff==1) printf("\n%s F Case %d token courant = %s",affiche,nb_case,token);

					if(type_token!=LPV)
						message_erreur(SX1900);

					/* on consomme le ; */
					cr=lire_token();
	  				if(cr==-1)
		 				message_erreur(SX1910);

					if(traceaff==1) printf("\n%s FB Case %d token courant = %s",affiche,nb_case,token);
				}
			else if((type_token==LCASE)||(type_token==LDEFAULT))
				{
					if(traceaff==1) printf("\n%s 'case' ou 'default' sans rien ",affiche);
					cases[nb_case]=NULL;
					break_or_not[nb_case]=0;
				}
			else if(type_token!=LEND) /* on analyse l'instruction */
			    {
					if(traceaff==1) printf("\n%s G Case %d token courant = %s - instruction detectee ",affiche,nb_case,token);

					cases[nb_case]=(INSTRUCTION *)analyse_liste_instruction(bloc_prof,1);

					if(type_token==LBREAK) /* un break;  */
						{
					 		if(traceaff==1) printf("\n%s H Case %d token courant = %s",affiche,nb_case,token);
							break_or_not[nb_case]=1;

					 		/* on consomme le break; */
							cr=lire_token();
	  						if(cr==-1)
		 						message_erreur(SX1920);

							if(traceaff==1) printf("\n%s I Case %d token courant = %s",affiche,nb_case,token);


							if(type_token!=LPV)
								message_erreur(SX1930);

							/* on consomme le ; */
							cr=lire_token();
	  						if(cr==-1)
		 						message_erreur(SX1940);

							if(traceaff==1) printf("\n%s J Case %d token courant = %s",affiche,nb_case,token);
						}
					else
						/* pas de break; */
						{
								break_or_not[nb_case]=0;
						}
				}

			nb_case++;

			if(nb_case>MAX_CASE)
				 message_erreur(SX1950);
			descend();
	    }

	 /* on lit le token suivant */
	 cr=lire_token();
	 if(cr==-1)
		 message_erreur(SX1960);

	 if(traceaff==1) printf("\n%s K Case %d token courant = %s",affiche,nb_case,token);

	 descend();

	 /*sleep(9000000);*/

	 r_inst=(INSTRUCTION*)nouvelle_instruction(bloc_prof,INST_SWITCH,0,NULL,NULL,NULL,NULL,NULL,NULL,0,NULL,NULL,NULL,NULL);

	 r_inst->instruction.sswitch.expression=expression;
	 r_inst->instruction.sswitch.nb_case=nb_case;

	 for(i=0;i<nb_case;i++)
		 {
	  			r_inst->instruction.sswitch.expression_case[i]=expression_case[i];
	  			r_inst->instruction.sswitch.cases[i]=cases[i];
	  			r_inst->instruction.sswitch.type_case[i]=type_case[i];
				r_inst->instruction.sswitch.break_or_not[i]=break_or_not[i];
		 }

	 return(r_inst);
  }

/* analyse exit */

INSTRUCTION * analyse_exit(char *bloc_prof)
  {
	  INSTRUCTION *r_inst;

	  monte();

	  if(traceaff==1) printf("\n%s : exit",affiche);

	  /* consomme le exit */
	  cr=lire_token();
	  if(cr==-1)
		  message_erreur(SX1970);

	  if(type_token!=LOP)
	 	  message_erreur(SX1980);

	    /* consomme le ( */
	  cr=lire_token();
	  if(cr==-1)
		 message_erreur(SX1990);

	  if(type_token!=LCL)
	 	 message_erreur(SX2000);

	     /* consomme le ) */
	  cr=lire_token();
	  if(cr==-1)
		 message_erreur(SX2010);

	  if(type_token!=LPV)
	 	 message_erreur(SX2020);

	   /* consomme le ) */
	  cr=lire_token();
	  if(cr==-1)
		 message_erreur(SX2030);

	 r_inst=(INSTRUCTION*)nouvelle_instruction(bloc_prof,INST_EXIT,0,NULL,NULL,NULL,NULL,NULL,NULL,0,NULL,NULL,NULL,NULL);

	 descend();

	 return(r_inst);
  }

/* analyse precedes */


/*
#define MAX_PRECEDES 20
#define SPRECEDES struct sprecedes
SPRECEDES {
	int  nb_label;
	char label[MAX_PRECEDES][MAX_IDENT];
};
*/

INSTRUCTION * analyse_precedes(char *bloc_prof)
  {
	  int nb_label;
	  char label[MAX_PRECEDES][MAX_IDENT];
	  INSTRUCTION *r_inst;
	  int i;

	  monte();

	  if(traceaff==1) printf("\n%s : precedes",affiche);

	  nb_label=0;

	  /* consomme le precedes */
	  cr=lire_token();
	  if(cr==-1)
		 message_erreur(SX2040);

	  for(;;)
		  {
			  if(type_token==LPV) break;

			  if(nb_label==MAX_PRECEDES)
				    message_erreur(SX2050);

			  if(type_token==LIDENT)
				  {
					  strcpy(&label[nb_label][0],token);
					  nb_label++;

					  /* consomme l'identifiant */
	  				  cr=lire_token();
	 				  if(cr==-1)
		 					message_erreur(SX2060);

					  if((type_token!=LV)&&(type_token!=LPV))
						  	message_erreur(SX2070);

					  if(type_token==LV)
					  	{
							/* consomme la ',' */
	  				 		 cr=lire_token();
	 				 		 if(cr==-1)
		 							message_erreur(SX2080);
						}
				  }
			  else
				  message_erreur(SX2090);

		  }

	     /* consomme le ; */
	  cr=lire_token();
	  if(cr==-1)
		 message_erreur(SX2100);

		 descend();

	 r_inst=(INSTRUCTION*)nouvelle_instruction(bloc_prof,INST_PRECEDES,0,NULL,NULL,NULL,NULL,NULL,NULL,0,NULL,NULL,NULL,NULL);

	 r_inst->instruction.sprecedes.nb_label=nb_label;

	 for(i=0;i<nb_label;i++)
		 {
	  			strcpy(&r_inst->instruction.sprecedes.label[i][0],&label[i][0]);
		 }

	 return(r_inst);
  }


 /* analyse les lident */

void analyse_lident(char *bloc_prof)
  {
	  int index;
	  SEXPRESSION *exp;
	  SAFFECTATION *affectation;
	  int type_pointeur_var;
	  char label[MAX_IDENT];
	  int flag_label;

	  monte();

	  flag_label=0;

	  /* on cherche à savoir si c'est un label */

	  if(traceaff==1) printf("\n%s Debut analyse Label = '%s' analysé",affiche,token);

	 /* cr=lire_token();
	  if(cr==-1)
		 message_erreur("\n Erreur Fatale #550 : fin prématuré du fichier source dans l'analyse des 'goto'");*/

   	  if(type_token==LIDENT)
		{
			strcpy(label,token);

			cr=lire_token();
	  		if(cr==-1)
		 		message_erreur(SX2110);

			if(type_token==LDP)
				{
					if(traceaff==1) printf("\n%s Label = '%s' analysé",affiche,label);
					flag_label=1;

 			 		nouvelle_instruction(bloc_prof,INST_LABEL,0,NULL,NULL,NULL,NULL,NULL,NULL,0,NULL,NULL,NULL,label);

					cr=lire_token();
	  				if(cr==-1)
		 				message_erreur(SX2120);
				}
			else
			  {
				  /* on se repositionne correctement */

				if(traceaff==1) printf("\n%s Ce n'est pas un label ",affiche);

				retour_arriere();
				retour_arriere();

				cr=lire_token();
	  			if(cr==-1)
					 message_erreur(SX2130);
			  }
	    }

 if(flag_label==0) /* ce n'est pas un label */
  {
	  if(traceaff==1) printf("\n%s : analyse fonction ou variable (token constatee =%s )",affiche,token);

	  /* cas des pointeurs */

	  type_pointeur_var=TYP_PTR_VAR_NORMAL;

	  if(type_token==LMUL)
		{
			if(traceaff==1) printf("\n X %s * detectee",affiche);
			cr=lire_token();
	   		if(cr==-1)
		 		message_erreur(SX2140);
			type_pointeur_var=TYP_PTR_VAR_POINTEUR;
			if(type_token==LMUL)
				{
					if(traceaff==1) printf("\n Z %s ** detectee",affiche);
					cr=lire_token();
	   			   	if(cr==-1)
		 				message_erreur(SX2150);
					type_pointeur_var=TYP_PTR_VAR_POINTEUR_POINTEUR;
				}
		}

	  index=recherche_variable(token,bloc_prof);
	  if(index!=-1)
		  {

			  affectation=analyse_affectation(bloc_prof,type_pointeur_var);

			/*  nouvelle_instruction(bloc_prof,INST_AFFECTATION,0,NULL,NULL,NULL,affectation,NULL,NULL,0,NULL,NULL,NULL,NULL);*/


 			  nouvelle_instruction(bloc_prof,INST_AFFECTATION,0,NULL,NULL,NULL,NULL,NULL,affectation,0,NULL,NULL,NULL,NULL);

			  if(traceaff==1) printf("\n%s fin d'analyse de variable %s",affiche,token);

			  if(type_token!=LPV)
				message_erreur(SX2160);

			  cr=lire_token();
	  		  if(cr==-1)
		 		message_erreur(SX2170);

		  }
	  else
		  {
			if(type_pointeur_var!=TYP_PTR_VAR_NORMAL)
			  	message_erreur(SX2180);

		  	index=recherche_fonction(token);

			if(index==-1)
				message_erreur(SX2190);

			exp=analyse_synt_fonction(bloc_prof);

			/* ajout d'une instuction appel de fonction*/
			nouvelle_instruction(bloc_prof,INST_FONCTION,0,exp,NULL,NULL,NULL,NULL,NULL,0,NULL,NULL,NULL,NULL);

			if(type_token!=LCL)
		 		message_erreur(SX2200);

			cr=lire_token();
	  		if(cr==-1)
		 		message_erreur(SX2210);

			if(type_token!=LPV)
				 message_erreur(SX2220);

			cr=lire_token();
	  		if(cr==-1)
		 		message_erreur(SX2230);

			if(traceaff==1) printf("\n%s +++++++++++++++++ CONTROLE APPEL DE FONCTION ++++++++++++++++++ ",affiche);
	  		affichage_recursif(exp);
	  		if(traceaff==1) printf("\n%s +++++++++++++++++ CONTROLE APPEL DE FONCTION ++++++++++++++++++ ",affiche);

	      }
   }

	 descend();

	 return;
  }

 /* analyse pointeur */

void analyse_pointeur(char *bloc_prof)
 {
  		int index;
	  	SEXPRESSION *exp,*affecte;
	  	SAFFECTATION *affectation;
	  	int type_pointeur_var;
	 	char label[MAX_IDENT];
	 	int flag_label;

		cr=lire_token();
	  	if(cr==-1)
		 	message_erreur(SX2240);

		if(type_token!=LOP) /* on se repositionne, ident avec * ou ** */
			{
				retour_arriere();
				retour_arriere();
				cr=lire_token();
				analyse_lident(bloc_prof);
			}
		else
			{
				if(traceaff==1) printf("\n%s *(VARIABLE+index)",affiche);

				affecte=analyse_indirection(bloc_prof);


	 			if(traceaff==1) printf("\n%s +++++++++++++++++ CONTROLE VARIABLE AFFECTEE ++++++++++++++++++ ",affiche);
	 			affichage_recursif(affecte);
				if(traceaff==1) printf("\n%s +++++++++++++++++ CONTROLE VARIABLE AFFECTEE ++++++++++++++++++ ",affiche);

				cr=lire_token();

				if(type_token!=LEG)
						message_erreur(SX2250);

				cr=lire_token();

				exp=analyse_expression(bloc_prof);

	 			if(traceaff==1) printf("\n%s +++++++++++++++++ CONTROLE EXPRESSION AFFECTEE ++++++++++++++++++ ",affiche);
	 			affichage_recursif(exp);
	 			if(traceaff==1) printf("\n%s +++++++++++++++++ CONTROLE EXPRESSION AFFECTEE ++++++++++++++++++ ",affiche);

				if(type_token!=LPV)
					message_erreur(SX2260);

			  	cr=lire_token();
	  		  	if(cr==-1)
		 			message_erreur(SX2270);


	 			affectation=(SAFFECTATION *)malloc(sizeof(SAFFECTATION));

				if(affectation==NULL)
		 			message_erreur(SX2280);

	 			affectation->variable=affecte;
	 			affectation->valeur_affectee=exp;
	 			affectation->type_affectation=AFF_PTR;

				nouvelle_instruction(bloc_prof,INST_AFFECTATION,0,NULL,NULL,NULL,NULL,NULL,affectation,0,NULL,NULL,NULL,NULL);

			}
	return;
 }

 /* analyse inline */

 void analyse_inline(char *bloc_prof)
  {
	  char sinline[MAX_INLINE];

		/* consommation de la chaine */
		cr=lire_token();
	  	if(cr==-1)
		 	message_erreur(SX2290);

		if(type_token!=CHAINE)
			message_erreur(SX2300);

		strcpy(sinline,token);

		/* consommation du ';' apres  la chaine */
		cr=lire_token();
	  	if(cr==-1)
		 	message_erreur(SX2310);

	     if(type_token!=LPV)
			message_erreur(SX2320);

		nouvelle_instruction(bloc_prof,INST_INLINE,0,NULL,NULL,NULL,NULL,NULL,NULL,0,NULL,NULL,NULL,sinline);

		/* consomme le ; */
	     cr=lire_token();
	     if(cr==-1)
		    message_erreur(SX2340);
  }


 /* analyse acquire */

void analyse_acquire(char *bloc_prof)
  {
	  INSTRUCTION *r_inst;
	  char ident_mutex[MAX_IDENT];

	  monte();

	  if(traceaff==1) printf("\n%s : acquire",affiche);

	  /* consomme le acquire */
	  cr=lire_token();
	  if(cr==-1)
		  message_erreur(SX2350);

	  if(type_token!=LOP)
	 	  message_erreur(SX2360);

	    /* consomme le ( */
	  cr=lire_token();
	  if(cr==-1)
		  message_erreur(SX2370);

	  if(type_token!=LIDENT)
		 {
			 	message_erreur(SX2380);
		 }

	  if(traceaff==1) printf("\n%s : acquire %s",affiche,token);

	  strcpy(ident_mutex,token);

	  /* consomme l'ident */
	  cr=lire_token();
	  if(cr==-1)
		  message_erreur(SX2390);

	  if(type_token!=LCL)
	 	  message_erreur(SX2400);

	     /* consomme le ) */
	  cr=lire_token();
	  if(cr==-1)
		 message_erreur(SX2410);

	  if(type_token!=LPV)
	 	 message_erreur(SX2420);

	   /* consomme le ) */
	  cr=lire_token();
	  if(cr==-1)
		 message_erreur(SX2430);

	 r_inst=(INSTRUCTION*)nouvelle_instruction(bloc_prof,INST_ACQUIRE,0,NULL,NULL,NULL,NULL,NULL,NULL,0,NULL,NULL,NULL,ident_mutex);

	 descend();

	 /*return(r_inst);*/
  }


 /* analyse release */

void analyse_release(char *bloc_prof)
  {
  	  INSTRUCTION *r_inst;
	  char ident_mutex[MAX_IDENT];

	  monte();

	  if(traceaff==1) printf("\n%s : release",affiche);

	  /* consomme le release */
	  cr=lire_token();
	  if(cr==-1)
		  message_erreur(SX2440);

	  if(type_token!=LOP)
	 	  message_erreur(SX2450);

	    /* consomme le ( */
	  cr=lire_token();
	  if(cr==-1)
		 message_erreur(SX2460);

	  if(type_token!=LIDENT)
		 {
			  	message_erreur(SX2470);
		 }

	  if(traceaff==1) printf("\n%s : release(%s)",affiche,token);

	  strcpy(ident_mutex,token);

	  /* consomme l'ident */
	  cr=lire_token();
	  if(cr==-1)
		  message_erreur(SX2480);


	  if(type_token!=LCL)
	 	 message_erreur(SX2490);

	     /* consomme le ) */
	  cr=lire_token();
	  if(cr==-1)
		 message_erreur(SX2500);

	  if(type_token!=LPV)
	 	 message_erreur(SX2510);

	   /* consomme le ; */
	  cr=lire_token();
	  if(cr==-1)
		 message_erreur(SX2520);

	 r_inst=(INSTRUCTION*)nouvelle_instruction(bloc_prof,INST_RELEASE,0,NULL,NULL,NULL,NULL,NULL,NULL,0,NULL,NULL,NULL,ident_mutex);

	 descend();

	/* return(r_inst);*/
  }

/* analyse Arrsize */

void analyse_arrsize(char *bloc_prof)
  {
  	  INSTRUCTION *r_inst;
	  char ident_arrsize[MAX_IDENT];
	  char ident_size[MAX_IDENT];

	  int index;

	  monte();

	  if(traceaff==1) printf("\n%s : arrsize",affiche);

	  /* consomme le arrsize */
	  cr=lire_token();
	  if(cr==-1)
		  message_erreur(SX2530);

	  if(type_token!=LOP)
	 	  message_erreur(SX2540);

	    /* consomme le ( */
	  cr=lire_token();
	  if(cr==-1)
		 message_erreur(SX2560);

	  if(type_token!=LIDENT)
		 {
			  	message_erreur(SX2570);
		 }

	  strcpy(ident_arrsize,token);

	  /* consomme l'ident */
	  cr=lire_token();
	  if(cr==-1)
		  message_erreur(SX2580);

	  if(type_token!=LV)
	 	 message_erreur(SX2590);

	  /* consomme le , */
	  cr=lire_token();
	  if(cr==-1)
		 message_erreur(SX2600);

	  if(type_token!=LIDENT)
		 {
			  	message_erreur(SX2610);
		 }

	  strcpy(ident_size,token);

	  /* consomme l'ident */
	  cr=lire_token();
	  if(cr==-1)
		  message_erreur(SX2620);

	  if(type_token!=LCL)
	 	 message_erreur(SX2630);

	     /* consomme le ) */
	  cr=lire_token();
	  if(cr==-1)
		 message_erreur(SX2640);

	  if(type_token!=LPV)
	 	 message_erreur(SX2650);

	   /* consomme le ; */
	  cr=lire_token();
	  if(cr==-1)
		 message_erreur(SX2660);

	 if(traceaff==1) printf("\n%s : arrsize(%s,%s)",affiche,ident_arrsize,ident_size);

	 r_inst=(INSTRUCTION*)nouvelle_instruction(bloc_prof,INST_ARRSIZE,0,NULL,NULL,NULL,NULL,NULL,NULL,0,NULL,NULL,NULL,NULL);

	 /* contrôle des variables */

	 index=recherche_variable(ident_arrsize,bloc_prof);
	 if(index==-1)
		 {
			 char mess[1000];

			 sprintf(mess,SX2670,ident_arrsize);
			 message_erreur(mess);
	  	 }

	 index=recherche_variable(ident_size,bloc_prof);
	 if(index==-1)
		 {
			 char mess[1000];

			 sprintf(mess,SX2680,ident_size);
			 message_erreur(mess);
	  	 }


	if(traceaff==1)
   		{
			index=recherche_variable(ident_arrsize,bloc_prof);
			printf("\n ARRSIZE arrsize = %s / genre %d / type %s index type %d ptr = %d",
				ident_arrsize,
				program.vg[index].type_variable_ptr->genre_variable,
				program.vg[index].type_variable_ptr->type,
				recherche_type(program.vg[index].type_variable_ptr->type),program.vg[index].type_pointeur);

			index=recherche_variable(ident_size,bloc_prof);
			printf("\n ARRSIZE size = %s / genre %d / type %s index type %d ptr = %d",
				ident_size,
				program.vg[index].type_variable_ptr->genre_variable,
				program.vg[index].type_variable_ptr->type,
				recherche_type(program.vg[index].type_variable_ptr->type),program.vg[index].type_pointeur);
	    }

	  index=recherche_variable(ident_arrsize,bloc_prof);
	  if(!(  (program.vg[index].type_variable_ptr->genre_variable==TABLEAU)||
		  ((program.vg[index].type_variable_ptr->genre_variable==ATOME) && (program.vg[index].type_pointeur==POINTEUR))
		))
		{
			 char mess[1000];

			 sprintf(mess,SX2690,ident_arrsize);
			 message_erreur(mess);
		}
	  index=recherche_variable(ident_size,bloc_prof);
	  if(!(
	  		(program.vg[index].type_variable_ptr->genre_variable==ATOME)&&
			(program.vg[index].type_pointeur==PASPOINTEUR)&&
			(strcmp(program.vg[index].type_variable_ptr->type,"int")==0)
		))
		{
			 char mess[1000];

			 sprintf(mess,SX2700,ident_size);
			 message_erreur(mess);
		}
	 /*{
	 	int sav;

	 	sav=traceaff;

		traceaff=1;

	 	affiche_variable(recherche_variable(ident_arrsize,bloc_prof));
	 	affiche_variable(recherche_variable(ident_size,bloc_prof));

		traceaff=sav;
	 }*/

	 strcpy(r_inst->instruction.sarrsize.label,ident_arrsize);
	 strcpy(r_inst->instruction.sarrsize.size,ident_size);



	 descend();

	/* return(r_inst);*/
  }

/* analyse Arrinit */

void analyse_arrinit(char *bloc_prof)
  {
  	  INSTRUCTION *r_inst;
	  char ident_arrinit[MAX_IDENT];
	  SEXPRESSION *exp;
	  SEXPRESSION *value;
	  int index;

	  monte();

	  if(traceaff==1) printf("\n%s : arrinit",affiche);

	  /* consomme le arrinit */
	  cr=lire_token();
	  if(cr==-1)
		  message_erreur(SX2710);

	  if(type_token!=LOP)
	 	  message_erreur(SX2720);

	    /* consomme le ( */
	  cr=lire_token();
	  if(cr==-1)
		 message_erreur(SX2730);

	  if(type_token!=LIDENT)
		 {
			  	message_erreur(SX2740);
		 }

	  strcpy(ident_arrinit,token);

	  /* consomme l'ident */
	  cr=lire_token();
	  if(cr==-1)
		 message_erreur(SX2750);
/* exp1 */
	  if(type_token!=LV)
	 	 message_erreur(SX2760);

	  /* consomme le , */
	  cr=lire_token();
	  if(cr==-1)
		 message_erreur(SX2770);

	  value=analyse_expression(bloc_prof);
/* fin exp1 */

/* exp2 */
	  if(type_token!=LV)
	 	 message_erreur(SX2780);

	  /* consomme le , */
	  cr=lire_token();
	  if(cr==-1)
		 message_erreur(SX2790);

	  exp=analyse_expression(bloc_prof);

/* fin exp2 */

	  if(type_token!=LCL)
	 	 message_erreur(SX2800);

	     /* consomme le ) */
	  cr=lire_token();
	  if(cr==-1)
		 message_erreur(SX2810);

	  if(type_token!=LPV)
	 	 message_erreur(SX2820);

	   /* consomme le ; */
	  cr=lire_token();
	  if(cr==-1)
		 message_erreur(SX2830);

	 if(traceaff==1) printf("\n%s : arrsize(%s,value,size)",affiche,ident_arrinit);


	 index=recherche_variable(ident_arrinit,bloc_prof);
	 if(index==-1)
		 {
			 char mess[1000];

			 sprintf(mess,SX2840,ident_arrinit);
			 message_erreur(mess);
	  	 }

	 if(traceaff==1)
   		{
			index=recherche_variable(ident_arrinit,bloc_prof);
			printf("\n ARRINIT arrinit = %s / genre %d / type %s index type %d ptr = %d",
				ident_arrinit,
				program.vg[index].type_variable_ptr->genre_variable,
				program.vg[index].type_variable_ptr->type,
				recherche_type(program.vg[index].type_variable_ptr->type),program.vg[index].type_pointeur);
	    }

	  index=recherche_variable(ident_arrinit,bloc_prof);
	  if(!(  (program.vg[index].type_variable_ptr->genre_variable==TABLEAU)||
		  ((program.vg[index].type_variable_ptr->genre_variable==ATOME) && (program.vg[index].type_pointeur==POINTEUR))
		))
		{
			 char mess[1000];

			 sprintf(mess,SX2850,ident_arrinit);
			 message_erreur(mess);
		}


	 r_inst=(INSTRUCTION*)nouvelle_instruction(bloc_prof,INST_ARRINIT,0,NULL,NULL,NULL,NULL,NULL,NULL,0,NULL,NULL,NULL,NULL);

	 strcpy(r_inst->instruction.sarrinit.label,ident_arrinit);
	 r_inst->instruction.sarrinit.expression_value_ptr=value;
	 r_inst->instruction.sarrinit.expression_size_ptr=exp;

	 descend();

	/* return(r_inst);*/

  }

/* analyse Arrsubset */

void analyse_arrsubset(char *bloc_prof)
  {
  	  INSTRUCTION *r_inst;
	  char ident_arrsubset_src[MAX_IDENT];
	  char ident_arrsubset_dst[MAX_IDENT];
	  SEXPRESSION *index;
	  SEXPRESSION *length;
	  int ind;

	  monte();

	  if(traceaff==1) printf("\n%s : arrsubset",affiche);

	  /* consomme le arrinit */
	  cr=lire_token();
	  if(cr==-1)
		  message_erreur(SX2860);

	  if(type_token!=LOP)
	 	  message_erreur(SX2870);

	    /* consomme le ( */
	  cr=lire_token();
	  if(cr==-1)
		 message_erreur(SX2880);

	  if(type_token!=LIDENT)
		 {
			  	message_erreur(SX2890);
		 }

	  strcpy(ident_arrsubset_dst,token);

	  /* consomme l'ident */
	  cr=lire_token();
	  if(cr==-1)
		 message_erreur(SX3000);

	  if(type_token!=LV)
	 	 message_erreur(SX3010);

	  /* consomme le ,  */
	  cr=lire_token();
	  if(cr==-1)
		 message_erreur(SX3020);

	   if(type_token!=LIDENT)
		 {
			  	message_erreur(SX3030);
		 }

	  strcpy(ident_arrsubset_src,token);

	  /* consomme l'ident */
	  cr=lire_token();
	  if(cr==-1)
		 message_erreur(SX3040);

/* exp1 */
	  if(type_token!=LV)
	 	 message_erreur(SX3050);

	  /* consomme le , */
	  cr=lire_token();
	  if(cr==-1)
		 message_erreur(SX3060);

	  index=analyse_expression(bloc_prof);
/* fin exp1 */

/* exp2 */
	  if(type_token!=LV)
	 	 message_erreur(SX3070);

	  /* consomme le , */
	  cr=lire_token();
	  if(cr==-1)
		 message_erreur(SX3080);

	  length=analyse_expression(bloc_prof);

/* fin exp2 */

	  if(type_token!=LCL)
	 	 message_erreur(SX3090);

	     /* consomme le ) */
	  cr=lire_token();
	  if(cr==-1)
		 message_erreur(SX3100);

	  if(type_token!=LPV)
	 	 message_erreur(SX3110);

	   /* consomme le ; */
	  cr=lire_token();
	  if(cr==-1)
		 message_erreur(SX3120);

	 if(traceaff==1) printf("\n%s : arrsubset(%s,%s,index,length)",affiche,ident_arrsubset_dst,ident_arrsubset_src);

	 	 /* contrôle des variables */

	 ind=recherche_variable(ident_arrsubset_src,bloc_prof);
	 if(ind==-1)
		 {
			 char mess[1000];

			 sprintf(mess,SX3130,ident_arrsubset_src);
			 message_erreur(mess);
	  	 }

	 ind=recherche_variable(ident_arrsubset_dst,bloc_prof);
	 if(ind==-1)
		 {
			 char mess[1000];

			 sprintf(mess,SX3140,ident_arrsubset_dst);
			 message_erreur(mess);
	  	 }


	if(traceaff==1)
   		{
			ind=recherche_variable(ident_arrsubset_src,bloc_prof);
			printf("\n ARRSUBSET src = %s / genre %d / type %s index type %d ptr = %d",
				ident_arrsubset_src,
				program.vg[ind].type_variable_ptr->genre_variable,
				program.vg[ind].type_variable_ptr->type,
				recherche_type(program.vg[ind].type_variable_ptr->type),
				program.vg[ind].type_pointeur);

			ind=recherche_variable(ident_arrsubset_dst,bloc_prof);
			printf("\n ARRSUBSET dst = %s / genre %d / type %s index type %d ptr = %d",
				ident_arrsubset_dst,
				program.vg[ind].type_variable_ptr->genre_variable,
				program.vg[ind].type_variable_ptr->type,
				recherche_type(program.vg[ind].type_variable_ptr->type),
				program.vg[ind].type_pointeur);
	    }

	  ind=recherche_variable(ident_arrsubset_src,bloc_prof);
	  if(!(  (program.vg[ind].type_variable_ptr->genre_variable==TABLEAU)||
		  ((program.vg[ind].type_variable_ptr->genre_variable==ATOME) && (program.vg[ind].type_pointeur==POINTEUR))
		))
		{
			 char mess[1000];

			 sprintf(mess,SX3150,ident_arrsubset_src);
			 message_erreur(mess);
		}
	  ind=recherche_variable(ident_arrsubset_dst,bloc_prof);
	  if(!(  (program.vg[ind].type_variable_ptr->genre_variable==TABLEAU)||
		  ((program.vg[ind].type_variable_ptr->genre_variable==ATOME) && (program.vg[ind].type_pointeur==POINTEUR))
		))
		{
			 char mess[1000];

			 sprintf(mess,SX3160,ident_arrsubset_dst);
			 message_erreur(mess);
		}

	 r_inst=(INSTRUCTION*)nouvelle_instruction(bloc_prof,INST_ARRSUBSET,0,NULL,NULL,NULL,NULL,NULL,NULL,0,NULL,NULL,NULL,NULL);

	 strcpy(r_inst->instruction.sarrsubset.label_src,ident_arrsubset_src);
	 strcpy(r_inst->instruction.sarrsubset.label_dst,ident_arrsubset_dst);
	 r_inst->instruction.sarrsubset.expression_index_ptr=index;
	 r_inst->instruction.sarrsubset.expression_length_ptr=length;

	 descend();

	/* return(r_inst);*/
  }

/* analyse Arrbuild */

void analyse_arrbuild(char *bloc_prof)
  {
	  INSTRUCTION *r_inst;
	  char ident_arrbuild[10][MAX_IDENT];
	  int nb;
	  int i;
	  int index;

	  nb=0;

	  monte();

	  if(traceaff==1) printf("\n%s : arrsubset",affiche);

	  /* consomme le arrinit */
	  cr=lire_token();
	  if(cr==-1)
		  message_erreur(SX3170);

	  if(type_token!=LOP)
	 	  message_erreur(SX3180);

	    /* consomme le ( */
	  cr=lire_token();
	  if(cr==-1)
		 message_erreur(SX3190);

	  for(;;)
	    {
		 	 if(nb>10)
				 {
					 message_erreur(SX3200);
				 }

	 		 if(type_token!=LIDENT)
		 		{
				  	message_erreur(SX3210);
				}

	  		  strcpy(ident_arrbuild[nb],token);
			  nb++;

	  		/* consomme l'ident */
	  		cr=lire_token();
	  		if(cr==-1)
				 message_erreur(SX3220);

	  		if(type_token!=LV)
	 	 		break;

	  		/* consomme le ,  */
	  		cr=lire_token();
	  		if(cr==-1)
		 		message_erreur(SX3230);
		 }

	  if(type_token!=LCL)
	 	 message_erreur(SX3240);

	  /* consomme le ) */
	  cr=lire_token();
	  if(cr==-1)
		 message_erreur(SX3250);

	  if(type_token!=LPV)
	 	 message_erreur(SX3260);

	   /* consomme le ; */
	  cr=lire_token();
	  if(cr==-1)
		 message_erreur(SX3270);

	 if(traceaff==1)
		 {
			 	printf("\n%s : arrbuild(",affiche);
				for(i=0;i<nb;i++)
					{
					   if(i!=0) printf(", ");
					   printf("%s",ident_arrbuild[i]);
					}
				printf(");");
		 }

	 for(i=0;i<nb;i++)
	   {

			 index=recherche_variable(&ident_arrbuild[i][0],bloc_prof);
	 		 if(index==-1)
		 		{
					 char mess[1000];

					 sprintf(mess,SX3280,&ident_arrbuild[i][0]);
			 		 message_erreur(mess);
	  	 		}

			if(traceaff==1)
   			{
				index=recherche_variable(&ident_arrbuild[i][0],bloc_prof);
				printf("\n ARRBUILD arrbuild[%d] = %s / genre %d / type %s index type %d ptr = %d",
					i,
					&ident_arrbuild[i][0],
					program.vg[index].type_variable_ptr->genre_variable,
					program.vg[index].type_variable_ptr->type,
					recherche_type(program.vg[index].type_variable_ptr->type),program.vg[index].type_pointeur);
	    	}

		    /*{
	 			int sav;

	 			sav=traceaff;

				traceaff=1;

	 			affiche_variable(recherche_variable(&ident_arrbuild[i][0],bloc_prof));

				traceaff=sav;
	 		}*/

			  index=recherche_variable(&ident_arrbuild[i][0],bloc_prof);
	 		  if(!(  (program.vg[index].type_variable_ptr->genre_variable==TABLEAU)||
		 		 ((program.vg[index].type_variable_ptr->genre_variable==ATOME) && (program.vg[index].type_pointeur==POINTEUR))
				))
				{
					 char mess[1000];

					 sprintf(mess,SX3290,&ident_arrbuild[i][0]);
					 message_erreur(mess);
				}
		}


	 r_inst=(INSTRUCTION*)nouvelle_instruction(bloc_prof,INST_ARRBUILD,0,NULL,NULL,NULL,NULL,NULL,NULL,0,NULL,NULL,NULL,NULL);

	 r_inst->instruction.sarrbuild.nb_tab=nb;

	 for(i=0;i<nb;i++)
		 {
			r_inst->instruction.sarrbuild.label[i]=(char *)malloc(MAX_IDENT);
	 		strcpy(r_inst->instruction.sarrbuild.label[i],&ident_arrbuild[i][0]);
		 }

	 descend();

	/* return(r_inst);*/
  }


 /* analyse instruction  */


INSTRUCTION * analyse_liste_instruction(char *bloc_prof,int tag)
  {
	  int arret;

	  if(type_token==LBEGIN)
		{
			int nb;
			INSTRUCTION *tab[10000];
			int i;

			monte();

			arret=0;

			cr=lire_token();
			if(cr==-1)
					message_erreur(SX3300);

			if(traceaff==1) printf("\n%s:BLOC { %d",affiche,ligne_courante);

			if(traceaff==1) printf("\n%s LISTE INST BLOC TOKEN %s %d",affiche,token,ligne_courante);

			nb=0;

	  		for(;arret==0;) /* for liste d'inscturciotn */
		  		{

					switch(type_token)
			   			{
				   			case LEND :
					  		 {
						   		if(traceaff==1) printf("\n%s : } %d",affiche,ligne_courante);
						   		arret=1;
					   		 } break;
				   			case LBEGIN:
					   		 {
						   		/*cr=lire_token();
			  					if(cr==-1)
									message_erreur("\n Erreur Fatale : fin prématuré du fichier source dans la zone de liste d'instruction  ");*/
						   		analyse_liste_instruction(bloc_prof,1);
					   		 }break;
				   			case LIF :
					   		 {
								analyse_if(bloc_prof);
					   		 }break;
				   			case LFOR:
					   		 {
						   		analyse_for(bloc_prof);
					   		 }break;
				   			case LDO :
					   		 {
						   		analyse_do_while(bloc_prof);
					   		 }break;
				   			case LGOTO :
					   		 {
						   		analyse_goto(bloc_prof);
					   		 }break;
				   			case LRETURN :
		               		 {
						   		analyse_return(bloc_prof);
					   		 } break;
							case LBREAK :
							 {
								analyse_break(bloc_prof);
							 }break;
							case LCONTINUE :
							 {
								 analyse_continue(bloc_prof);
							 }break;
							case LSWITCH :
							 {
								 analyse_switch(bloc_prof);
							 }break;
							case LEXIT:
							 {
								 analyse_exit(bloc_prof);
							 }break;
							case LPRECEDES:
							 {
								 analyse_precedes(bloc_prof);
							 }break;
							case LINLINE:
							 {
								 analyse_inline(bloc_prof);
							 }break;

							case LACQUIRE:
							 {
								 analyse_acquire(bloc_prof);
							 }break;
							case LRELEASE:
							 {
								 analyse_release(bloc_prof);
							 }break;
							case LMUL:
							 {
								analyse_pointeur(bloc_prof);
							 } break;
/* tableau */
							case LARRSIZE:
							 {
								 analyse_arrsize(bloc_prof);
							 }break;
							case LARRINIT:
							 {
								 analyse_arrinit(bloc_prof);
							 }break;
							case LARRSUBSET:
							 {
								 analyse_arrsubset(bloc_prof);
							 }break;
							case LARRBUILD:
							 {
								 analyse_arrbuild(bloc_prof);
							 }break;

/* fin tableau */
				   			case LIDENT: /* variable, fonction ou label */
					   		 {
						   		analyse_lident(bloc_prof);
					   		 } break;
				   			default:
							  {
								  arret=2;
							  }
							 break;
								  /*message_erreur("Erreur Fatale :: Mauvais format d'instruction ");*/
			   			} /*switch*/

					if(arret==0) tab[nb++]=(INSTRUCTION *)&tab_instruction[nb_instruction-1];

		  		} /* for liste d'instruction */
			if(arret==1)
				{
					cr=lire_token();
					if(cr==-1)
						message_erreur(SX3310);
			    }

			tab_instruction[nb_instruction].instruction.sbloc.liste_instruction=(INSTRUCTION **)malloc( sizeof(INSTRUCTION *) *(nb+1));
			if(tab_instruction[nb_instruction].instruction.sbloc.liste_instruction==NULL)
				message_erreur(SX3320);


			for(i=0;i<nb;i++)
				tab_instruction[nb_instruction].instruction.sbloc.liste_instruction[i]=(INSTRUCTION *)tab[i];
			strcpy(tab_instruction[nb_instruction].bloc,bloc_prof);
			tab_instruction[nb_instruction].index=nb_instruction;
			tab_instruction[nb_instruction].instruction.sbloc.nb_instruction=nb;
	  		tab_instruction[nb_instruction].type_instruction=INST_BLOC;
			nb_instruction++;

		    if(traceaff==1) printf("\n%s FIN LISTE INST BLOC TOKEN %s %d",affiche,token,ligne_courante);
			if(traceaff==1) printf("\n%s:FIN BLOC} %d",affiche,ligne_courante);

			descend();
		  }
		else if(tag==0) /* c'est le corps de la tache ou de la routine ou de la fonction */
		  {
			  int nb;
			  int i;
			  INSTRUCTION *tab[10000];

			  arret=0;

			  nb=0;

			  if(traceaff==1) printf("\n%s LISTE INST CORPS TACHE ou FONCTION TOKEN %s",affiche,token);
			  for(;arret==0;)
		  		{ /* ce n'est pas un bloc */
			  		if(traceaff==1) printf("\n%s  INST CORPS TOKEN %s",affiche,token);
			  		switch(type_token)
			   			{
							case LEND :
					  		 {
						   		if(traceaff==1) printf("\n%s : } %d",affiche,ligne_courante);
						   		arret=1;
					   		 } break;
				   			case LIF :
					   		 {
								analyse_if(bloc_prof);
					   		 }break;
				   			case LFOR:
					   		 {
						   		analyse_for(bloc_prof);
					   		 }break;
				   			case LDO :
					   		 {
						   		analyse_do_while(bloc_prof);
					   		 }break;
				   			case LGOTO :
					   		 {
						   		analyse_goto(bloc_prof);
					   		 }break;
				   			case LRETURN :
		               		 {
						   		analyse_return(bloc_prof);
					   		 } break;
							case LSWITCH :
							 {
								 analyse_switch(bloc_prof);
							 }break;
							case LEXIT:
							 {
								 analyse_exit(bloc_prof);
							 }break;
							case LPRECEDES:
							 {
								 analyse_precedes(bloc_prof);
							 }break;
							case LINLINE:
							 {
								 analyse_inline(bloc_prof);
							 }break;

							case LACQUIRE:
							 {
								 analyse_acquire(bloc_prof);
							 }break;
							case LRELEASE:
							 {
								 analyse_release(bloc_prof);
							 }break;
							case LBREAK :
							 {
								analyse_break(bloc_prof);
							 }break;
							case LCONTINUE :
							 {
								 analyse_continue(bloc_prof);
							 }break;
							case LMUL:
							 {
								 analyse_pointeur(bloc_prof);
							 } break;

/* tableau */
							case LARRSIZE:
							 {
								 analyse_arrsize(bloc_prof);
							 }break;
							case LARRINIT:
							 {
								 analyse_arrinit(bloc_prof);
							 }break;
							case LARRSUBSET:
							 {
								 analyse_arrsubset(bloc_prof);
							 }break;
							case LARRBUILD:
							 {
								 analyse_arrbuild(bloc_prof);
							 }break;

/* fin tableau */

				   			case LIDENT:
					   		 {
						   		analyse_lident(bloc_prof);
					   		 } break;
				   			default:
								  message_erreur(SX3340);
			   			} /*switch*/

					if(traceaff==1) printf("\n%s  FIN INST CORPS TOKEN %s",affiche,token);

					if (arret==0) tab[nb++]=(INSTRUCTION *)&tab_instruction[nb_instruction-1];

		  		} /* ce n'est pas un bloc  */

			tab_instruction[nb_instruction].instruction.sbloc.liste_instruction=(INSTRUCTION **)malloc(sizeof(INSTRUCTION *)*(nb+1));
			if(tab_instruction[nb_instruction].instruction.sbloc.liste_instruction==NULL)
				message_erreur(SX3350);


			for(i=0;i<nb;i++)
				tab_instruction[nb_instruction].instruction.sbloc.liste_instruction[i]=(INSTRUCTION *)tab[i];
			strcpy(tab_instruction[nb_instruction].bloc,bloc_prof);
			tab_instruction[nb_instruction].index=nb_instruction;
			tab_instruction[nb_instruction].instruction.sbloc.nb_instruction=nb;
	  		tab_instruction[nb_instruction].type_instruction=INST_BLOC;
			nb_instruction++;

			if(traceaff==1) printf("\n%s FIN LISTE INST CORPS TOKEN %s",affiche,token);
			descend();
		  }
		else /* ce n'est pas un bloc ni le corps d'une tache/routine:fonction */
		  {
		  		{ /* ce n'est pas un bloc */
			  		if(traceaff==1) printf("\n%s INST SIMPLE TOKEN %s",affiche,token);
			  		switch(type_token)
			   			{
				   			case LIF :
					   		 {
								analyse_if(bloc_prof);
					   		 }break;
				   			case LFOR:
					   		 {
						   		analyse_for(bloc_prof);
					   		 }break;
				   			case LDO :
					   		 {
						   		analyse_do_while(bloc_prof);
					   		 }break;
				   			case LGOTO :
					   		 {
						   		analyse_goto(bloc_prof);
					   		 }break;
				   			case LRETURN :
		               		 {
						   		analyse_return(bloc_prof);
					   		 } break;
							case LBREAK :
							 {
								analyse_break(bloc_prof);
							 }break;
							case LCONTINUE :
							 {
								 analyse_continue(bloc_prof);
							 }break;
							case LSWITCH :
							 {
								 analyse_switch(bloc_prof);
							 }break;
							case LEXIT:
							 {
								 analyse_exit(bloc_prof);
							 }break;
							case LPRECEDES:
							 {
								 analyse_precedes(bloc_prof);
							 }break;
							case LINLINE:
							 {
								 analyse_inline(bloc_prof);
							 }break;
							case LACQUIRE:
							 {
								 analyse_acquire(bloc_prof);
							 }break;
							case LRELEASE:
							 {
								 analyse_release(bloc_prof);
							 }break;
				   			case LMUL:
							 {
								 analyse_pointeur(bloc_prof);
							 } break;

/* tableau */
							case LARRSIZE:
							 {
								 analyse_arrsize(bloc_prof);
							 }break;
							case LARRINIT:
							 {
								 analyse_arrinit(bloc_prof);
							 }break;
							case LARRSUBSET:
							 {
								 analyse_arrsubset(bloc_prof);
							 }break;
							case LARRBUILD:
							 {
								 analyse_arrbuild(bloc_prof);
							 }break;

/* fin tableau */

							case LIDENT:
					   		 {
						   		 analyse_lident(bloc_prof);
					   		 } break;
				   			default:
								 message_erreur(SX3360);
			   			} /*switch*/
			   		/*cr=lire_token();
			  		if(cr==-1)
						message_erreur("\n Erreur Fatale : fin prématuré du fichier source dans la zone de liste d'instruction  ");*/
					if(traceaff==1) printf("\n%s FIN INST SIMPLE TOKEN %s",affiche,token);
					descend();
		  		} /* ce n'est pas un bloc  */
		  }

		/*descend();*/
		return(&tab_instruction[nb_instruction-1]); /* retourne la dernière instruction */
  }


/* analyse des fonctions */
void analyse_fonction(void)
 {
	 int i;
	 char tampon[100];
	 char *ptr;

	 strcpy(tampon,module);
	 ptr=&tampon[0]+strlen(tampon)-11;

	 flag_return=1;

	 tab_fonction[nb_fonction].nb_parametre=0;
	 tab_fonction[nb_fonction].nb_var_locale=0;

	/* printf("\n%s %s",ptr,module);*/

	 if(strcmp(ptr,"cop.lib.txt")==0)
		 tab_fonction[nb_fonction].librairie=1;
	 else
		 tab_fonction[nb_fonction].librairie=0;

	 switch(type_token)
	    {
				case LENTIER: /* type atome simple */
				case LCHAR:
				case LSCHAR:
				case LSINT:
				case LLONG:
				case LSLONG:
				case LFLOTTANT:
				case OCTET:
					{
						int index_type;

						index_type=recherche_type(token);

						tab_fonction[nb_fonction].type_variable_retournee_ptr=(TYPE_VARIABLE *)&tab_type_variable[index_type];
						tab_fonction[nb_fonction].type_pointeur=PASPOINTEUR;

						if(traceaff==1) printf("\n fonction retourne un atome %s",token);

						cr=lire_token();
						if(cr==-1)
								message_erreur(SX3370);
					}
					break;
				case LOP : /* type structure ou atome * ou ** */
					{
						int index_type;

						cr=lire_token();

						if(cr==-1)
							message_erreur(SX3380);

						if( (type_token!=LIDENT)&&
							(type_token!=LENTIER)&&
							(type_token!=OCTET)&&
							(type_token!=LFLOTTANT)&&
							(type_token!=LCHAR)&&
							(type_token!=LSCHAR)&&
							(type_token!=LSINT)&&
							(type_token!=LLONG)&&
							(type_token!=LSLONG)
						   )
								message_erreur(SX3390);

						index_type=recherche_type(token);
						if(index_type==-1)
							message_erreur(SX3400);

						tab_fonction[nb_fonction].type_variable_retournee_ptr=(TYPE_VARIABLE *)&tab_type_variable[index_type];
						tab_fonction[nb_fonction].type_pointeur=PASPOINTEUR;

						if(traceaff==1) printf("\n fonction retourne un type %s",token);

						cr=lire_token();

						if(cr==-1)
							message_erreur(SX3410);

						if(type_token!=LMUL)
								message_erreur(SX3420);

						cr=lire_token();

						if(cr==-1)
							message_erreur(SX3430);

						if((type_token!=LMUL)&&(type_token!=LCL))
								message_erreur(SX3440);

						if(type_token==LCL)
								{
									tab_fonction[nb_fonction].type_pointeur=POINTEUR;
									if(traceaff==1) printf(" *");
								}
						else
								{
									tab_fonction[nb_fonction].type_pointeur=POINTEURPOINTEUR;
									if(traceaff==1) printf(" **");
								}

						if(type_token==LMUL)
							{
									cr=lire_token();
									if(cr==-1)
										message_erreur(SX3450);

									if((type_token!=LCL))
										message_erreur(SX3460);
							}

						cr=lire_token();
						if(cr==-1)
								message_erreur(SX3470);
				    }
					break;
				case LIDENT : /* pas de type donc int par defaut */
					{
						int index_type;

						index_type=recherche_type("int");
						if(index_type==-1)
							message_erreur(SX3480);

						tab_fonction[nb_fonction].type_variable_retournee_ptr=(TYPE_VARIABLE *)&tab_type_variable[index_type];
						tab_fonction[nb_fonction].type_pointeur=PASPOINTEUR;
					}
					break;
				case LVOID : /* void */

					{
						int index_type;

						index_type=recherche_type("void");
						if(index_type==-1)
							message_erreur(SX3490);

						tab_fonction[nb_fonction].type_variable_retournee_ptr=(TYPE_VARIABLE *)&tab_type_variable[index_type];
						tab_fonction[nb_fonction].type_pointeur=PASPOINTEUR;

						cr=lire_token();
						if(cr==-1)
								message_erreur(SX3500);
					}
					break;

		} /* switch de type retourné */

		if(type_token!=LIDENT)
			message_erreur(SX3510);

		if(recherche_fonction(token)==-1)
			strcpy(tab_fonction[nb_fonction].ident_fonction,token);
		else
				message_erreur(SX3520);


		cr=lire_token();

		if(cr==-1)
			 message_erreur(SX3530);

		if(type_token!=LOP)
			message_erreur(SX3540);

		/* analyse des arguments de la fonction */


		for(;;)
		  {
			    char type[MAX_IDENT];
				char ident[MAX_IDENT];
				int  index_type;
				int type_pointeur;
				int modify;

				modify=0;

				cr=lire_token();
				if(cr==-1)
			 		message_erreur(SX3550);

				if(type_token==LCL)
					{
						if(traceaff==1) printf("\n Fin d'analyse des arguments ");
						break;
					}


				/* ce parametre est-il modifiable ? */
				if(type_token==LMODIFY)
					{
						if(traceaff==1) printf("\n Parametre Modifiable");
						modify=-1;

						cr=lire_token();
						if(cr==-1)
			 				message_erreur(SX3560);

					}

				strcpy(type,token);

				if(type_token==LVOID)
					{
						if(traceaff==1) printf("\n Parametre VOID ");
						continue; /* pas de paramètre */
					}

				index_type=recherche_type(type);
				if(index_type==-1)
					message_erreur(SX3570);

				cr=lire_token();
				if(cr==-1)
			 		message_erreur(SX3580);


				if(type_token==LIDENT) /* c'est une variable qui ne peut pas être de type structure */
					{
						if(traceaff==1) printf("\n Paramètre %s %s",type,token);
						strcpy(ident,token);
						/*if(tab_type_variable[index_type].genre_variable==STRUCTURE)
							message_erreur("Erreur Fatale #S0228 :: On ne peut pas passer une structure sans que ça soit un pointeur ");*/

						ajout_variable(tab_fonction[nb_fonction].ident_fonction,
									   -1,
									   type,
									   ident,
									   NULL,
									   modify,
									   PASPOINTEUR);

				   }
				else /* c'est un pointeur ou un pointeur de pointeur */
				   {
					   type_pointeur=POINTEUR;

					   if(type_token!=LMUL)
						    message_erreur(SX3590);

					   cr=lire_token();
					   if(cr==-1)
			 				message_erreur(SX3600);

					   if((type_token!=LMUL)&&(type_token!=LIDENT))
	    					message_erreur(SX3610);

					   if(type_token==LMUL)
						   {
								type_pointeur=POINTEURPOINTEUR;
								cr=lire_token();
					   			if(cr==-1)
			 					message_erreur(SX3620);
						   }

						if(type_token!=LIDENT)
						 		message_erreur(SX3630);

						if(traceaff==1) printf("\n Paramètre %s %s",type,token);
						strcpy(ident,token);

						ajout_variable(tab_fonction[nb_fonction].ident_fonction,
									   -1,
									   type,
									   ident,
									   NULL,
									   modify,
									   type_pointeur);
				   } /* fin du cas pointeur de pointeur */
/* fin masuqage code */
				  /* Y-a-t-il une virgule */
				cr=lire_token();
			    if(cr==-1)
			 				message_erreur(SX3640);

				/* s'il y a une virgule je consomme la virgule */
				if((type_token!=LV)&&(type_token!=LCL))
				   	message_erreur(SX3650);

				/* si c'est une ) il faut revenri un cran en arriere pour la reconsommer au debut de l'itération */
				if(type_token==LCL)
					retour_arriere();

				/* increment du nombre de paramètre */

				tab_fonction[nb_fonction].parametres=(VARIABLE_GLOBALE *)&program.vg[program.nb_vg-1];
				tab_fonction[nb_fonction].nb_parametre++;
		 }

		/* fin d'analyse des arguments */

		cr=lire_token();

		if(cr==-1)
			 message_erreur(SX3660);

		if(type_token!=LBEGIN)
			message_erreur(SX3670);



		/* variable locale et liste d'instructions */


		 {
			int sauv_index;

			sauv_index=program.nb_vg;
			analyse_variable(tab_fonction[nb_fonction].ident_fonction);
			tab_fonction[nb_fonction].var_locale=(VARIABLE_GLOBALE *)&program.vg[sauv_index];
			tab_fonction[nb_fonction].nb_var_locale=program.nb_vg-sauv_index;
			if(traceaff==1) printf("\n     %d variable locale analysee ",tab_fonction[nb_fonction].nb_var_locale);
		 }


		 if(traceaff==1) printf("\n TOKEN INSTRUCTION %s %d",token,ligne_courante);

		/* analyse liste instruction */
		if(type_token!=LEND)
		 {
			int sauv_index;

			sauv_index=nb_instruction;

		    analyse_liste_instruction(tab_fonction[nb_fonction].ident_fonction,0);

			tab_fonction[nb_fonction].liste_instruction=(INSTRUCTION *)&tab_instruction[/*sauv_index*/nb_instruction-1];
			tab_fonction[nb_fonction].nb_instruction=nb_instruction-sauv_index;

			if(traceaff==1) printf("\n     %d instruction analysee TOKEN  = %s %d",tab_fonction[nb_fonction].nb_instruction,token,ligne_courante);

			/*cr=lire_token();
			if(cr==-1)
				 message_erreur("\n Erreur Fatale : fin prématuré du fichier source dans la declaration de fonction  ");*/

		 }

		/* fin des instruction*/

		if(traceaff==1) printf("\n  TOKEN fin fonction  = %s %d",token,ligne_courante);

		if(type_token!=LEND)
			message_erreur(SX3680);

		if(traceaff==1) printf("\n Nouvelle fonction :: %s",tab_fonction[nb_fonction].ident_fonction);

		nb_fonction++;

		flag_return=0;

 }

/* analyse des subroutine */

void analyse_subroutine(void)
 {


 }

void analyse_mutex(void)
 {
 	int i;

	 if(traceaff==1) printf("\n analyse des mutex ");

	 cr=lire_token();
	 if(cr==-1)
			message_erreur(SX3690);

	 for(;;)
 		{
	 		if(type_token!=LIDENT)
				message_erreur(SX3700);

			/* recherche de double declaration */

			for(i=0;i<nb_mutex;i++)
				{
					/*printf("\n compare '%s' '%s' ",token,tab_mutex[i].ident);*/
					if(strcmp(token,tab_mutex[i].ident)==0) break;
				}

			if(i<nb_mutex)
				{
					char libelle[200];

					sprintf(libelle,SX3710,
												token,
												module,
												ligne_courante,
												tab_mutex[i].module,
												tab_mutex[i].ligne);
					message_erreur(libelle);
				}

			/* ajout */
			strcpy(tab_mutex[nb_mutex].ident,token);
     		strcpy(tab_mutex[nb_mutex].module,module);
			tab_mutex[nb_mutex].ligne=ligne_courante;


			if(traceaff==1) printf("\n Nouveau mutex %s module %s ligne %d",
										tab_mutex[nb_mutex].ident,
										tab_mutex[nb_mutex].module,
										tab_mutex[nb_mutex].ligne);
			nb_mutex++;

			cr=lire_token();

			if((type_token!=LV)&&(type_token!=LPV))
				message_erreur(SX3720);

			if(type_token==LPV)
				break;

			if(type_token!=LV)
				message_erreur(SX3730);

			cr=lire_token();
		}

	if(traceaff==1) printf("\n fin d'analyse des mutex");
 }

/* analyse des taches */

void analyse_tache(void)
 {
	 char ident_tache[MAX_IDENT];

	 if(traceaff==1) printf("\n analyse d'une tache ");

	 tab_tache[nb_tache].nb_var_locale=0;

	 cr=lire_token();
			if(cr==-1)
				 message_erreur(SX3740);

	 if(type_token!=LIDENT)
			message_erreur(SX3750);

	 strcpy(ident_tache,token);
     strcpy(tab_tache[nb_tache].ident_tache,token);

	 cr=lire_token();
			if(cr==-1)
				 message_erreur(SX3760);

	if(type_token!=LOP)
			message_erreur(SX3770);

	 cr=lire_token();
			if(cr==-1)
				 message_erreur(SX3780);

	if(type_token!=LCL)
			message_erreur(SX3790);

	cr=lire_token();

	if(cr==-1)
		 message_erreur(SX3800);

	if(type_token!=LBEGIN)
		message_erreur(SX3810);

	 {
		int sauv_index;

		sauv_index=program.nb_vg;
		analyse_variable(tab_tache[nb_tache].ident_tache);
		tab_tache[nb_tache].var_locale=(VARIABLE_GLOBALE *)&program.vg[sauv_index];
		tab_tache[nb_tache].nb_var_locale=program.nb_vg-sauv_index;
		if(traceaff==1) printf("\n     %d variable locale analysee ",tab_tache[nb_tache].nb_var_locale);
	 }


	 if(traceaff==1) printf("\n TOKEN INSTRUCTION %s",token);

		/* analyse liste instruction */
	if(type_token!=LEND)
		 {
			int sauv_index;

			sauv_index=nb_instruction;

		    analyse_liste_instruction(tab_tache[nb_tache].ident_tache,0);

			tab_tache[nb_tache].liste_instruction=(INSTRUCTION *)&tab_instruction[/*sauv_index*/nb_instruction-1];
			tab_tache[nb_tache].nb_instruction=nb_instruction-sauv_index;

			if(traceaff==1) printf("\n     %d instruction analysee TOKEN  = %s %d",tab_tache[nb_tache].nb_instruction,token,ligne_courante);


		 }

		/* fin des instruction*/

	if(traceaff==1) printf("\n  TOKEN fin tache  = %s %d",token,ligne_courante);

	if(type_token!=LEND)
			message_erreur(SX3820);

	if(traceaff==1) printf("\n Nouvelle fonction :: %s",tab_tache[nb_tache].ident_tache);

	nb_tache++;

 }

 /* analyse du corps du programme */
 /* le corps de programme est une suite de fonction ou de taches */
 void analyse_corps(char *prof_bloc)
  {

	  if(traceaff==1) printf("\n analyse syntaxique des fonctions ou des taches ");

	  if(traceaff==1) printf("\n le token en cours = %s ligne = %d",token,ligne_courante);

	  for(;;)
		  {

			indentation=0;

			if(type_token==LMUTEX)
				analyse_mutex();
			else if(type_token==LTASK)
				analyse_tache();
			else if(type_token==LSUBROUTINE)
				analyse_subroutine();
			else if(detecte_fonction()!=-1)
				analyse_fonction();
			else
			    analyse_variable("0");

			/* on detecte la fin de compilation */
			if (index_lexeme==nb_echant) break;
		  }
	  if(traceaff==1) printf("\n fin de compilation ");
	  /*sleep(20000);*/
  }



