-   
-   
- int Sigue,Tamano,Cont,PosIni,i,PosVec,j,PosParen,Error,CanTonk,Tamano2,k,Opcion; 
- char CadenaLeida[150],Bloques[50][150],SiFor[150],Tokens[50][150],NuevaCadena[150]; 
- int pIni; 
- char wh[10],od[10]; 
-   
- int EsOperador(char QueAnalizar) 
- {if (QueAnalizar=='+') 
-  {return(1);} 
-  else if (QueAnalizar=='-') 
-  {return(1);} 
-  else if (QueAnalizar=='*') 
-  {return(1);} 
-  else if (QueAnalizar=='/') 
-  {return(1);} 
-  else if (QueAnalizar=='(') 
-  {return(2);} 
-  else if (QueAnalizar==')') 
-  {return(2);} 
-  else if (QueAnalizar=='[') 
-  {return(2);} 
-  else if (QueAnalizar==']') 
-  {return(2);} 
-  else if (QueAnalizar=='<') 
-  {return(3);} 
-  else if (QueAnalizar=='>') 
-  {return(3);} 
-  else if (QueAnalizar=='=') 
-  {return(3);} 
-  else if (QueAnalizar=='!') 
-  {return(3);} 
-  else 
-  {return(0);} 
- } 
-   
- void EsFor() 
- {printf("nntDIGITE LA SENTENCIA: "); 
-  scanf("%s",CadenaLeida); 
-   
-  Tamano=strlen(CadenaLeida); 
-  PosParen=0; 
-  for(i=0;i<=Tamano-1;i++) 
-  { 
-   if(CadenaLeida[i]=='(') 
-   {PosVec=0; 
-    for(j=0;j<=i-1;j++) 
-    {SiFor[PosVec]=CadenaLeida[j]; 
-     PosVec=PosVec+1; 
-    } 
-    PosParen=i; 
-    break; 
-   } 
-  } 
-  if(PosParen!=3) 
-  {printf("ntLA SENTENCIA DIGITADANO NO CUMPLE CON LA SINTAXIS DEL FOR"); 
-   printf("ntERROR: %s", SiFor); 
-  } 
-  else  
-   if(strcmp(SiFor,"for")!=0 && strcmp(SiFor,"For")!=0 && strcmp(SiFor,"FOR")!=0) 
-   {printf("ntLA SENTENCIA DIGITADANO NO CUMPLE CON LA SINTAXIS DEL FOR"); 
-   printf("ntERROR: %s", SiFor); 
-  } 
-  else if (CadenaLeida[Tamano-1]!=')') 
-  {printf("ntLA SENTENCIA DIGITADANO CUMPLE CON LA SINTAXIS DEL FOR"); 
-   printf("ntERROR: %c FALTA PARENTESIS DE CIERRE FINAL", CadenaLeida[Tamano-1]); 
-  } 
-  else 
-  {Cont=0; 
-   PosIni=4; 
-   for(i=4;i<=Tamano-2;i++) 
-   { 
-    if(CadenaLeida[i]==';') 
-    {PosVec=0; 
-     for(j=PosIni;j<=i;j++) 
-     {Bloques[Cont][PosVec]=CadenaLeida[j]; 
-      PosVec=PosVec+1; 
-     } 
-     Cont=Cont+1; 
-     PosIni=i+1; 
-    } 
-   } 
-   
-   PosVec=0; 
-   for(j=PosIni;j<=Tamano-2;j++) 
-   {Bloques[Cont][PosVec]=CadenaLeida[j]; 
-    PosVec=PosVec+1; 
-   } 
-   if (Cont<2) 
-   {printf("ntLA SENTENCIA DIGITADANO CUMPLE CON LA SINTAXIS DEL FOR"); 
-    printf("ntERROR: FALTAN BLOQUES DEL FOR 'for([init-expr];[cond-expr];[loop-expr])'"); 
-   } 
-   else if (Cont!=2) 
-   {printf("ntLA SENTENCIA DIGITADANO CUMPLE CON LA SINTAXIS DEL FOR"); 
-    printf("ntERROR: HAY 3 BLOQUES PARA EL FOR 'for([init-expr];[cond-expr];[loop-expr])'"); 
-   } 
-   else 
-   { 
-    strcpy(Tokens[0],SiFor); 
-    Tokens[1][0]=CadenaLeida[3]; 
-    CanTonk=1; 
-      for(i=0;i<=Cont;i++) 
-    { 
-     PosVec=0; 
-     for(k=0;k<=149;k++) 
-     {NuevaCadena[k]=0;} 
-     Tamano2=strlen(Bloques[i])-1; 
-      for(j=0;j<=Tamano2;j++) 
-     {if(EsOperador(Bloques[i][j])==0 && Bloques[i][j]!=';') 
-      {NuevaCadena[PosVec]=Bloques[i][j]; 
-       PosVec=PosVec+1; 
-      } 
-      else 
-      {if (strlen(NuevaCadena)!=0) 
-       {CanTonk=CanTonk+1; 
-        for(k=0;k<=PosVec;k++) 
-        {Tokens[CanTonk][k]=NuevaCadena[k];} 
-              PosVec=0; 
-        for(k=0;k<=149;k++) 
-        {NuevaCadena[k]=0;} 
-       } 
-       CanTonk=CanTonk+1; 
-       Tokens[CanTonk][0]=Bloques[i][j]; 
-      } 
-     } 
-    } 
-    if (strlen(NuevaCadena)!=0) 
-    {CanTonk=CanTonk+1; 
-     for(k=0;k<=PosVec;k++) 
-     {Tokens[CanTonk][k]=NuevaCadena[k];} 
-     PosVec=0; 
-     for(k=0;k<=149;k++) 
-     {NuevaCadena[k]=0;} 
-    } 
-    CanTonk=CanTonk+1; 
-    Tokens[CanTonk][0]=41; //Ascii=')' 
-    printf("nntTOKENS IDENTIFICADOS"); 
-    for(i=0;i<=CanTonk;i++) 
-    {if (strlen(Tokens[i])>0) 
-     {printf("nt%dt%s",i+1,Tokens[i]);} 
-     else 
-     {printf("nt%dt%c",i+1,Tokens[i]);} 
-     {printf("ttTOKENS OK VALIDADO..!!!");} 
-     } 
-    } 
-   } 
- } 
- main() 
- {Sigue=0; 
-  do 
-  {  
-   system("cls"); 
-   printf("nnttttPROGRAMA    QUE    VALIDA"); 
-   printf("nntttttCICLO FORnn"); 
-   printf("nnttt1. ANALIZAR CICLO FORnnn"); 
-   printf("nnttttDIGITE OPCION: "); 
-   scanf("%d", &Opcion); 
-   for(i=0;i<=149;i++) 
-   {CadenaLeida[i]=0; 
-    SiFor[i]=0; 
-   } 
-   for(i=0;i<=49;i++) 
-   {for(j=0;j<=149;j++) 
-    {Bloques[i][j]=0; 
-     Tokens[i][j]=0; 
-    } 
-   } 
-   if(Opcion==1) 
-   {EsFor(); 
-    printf("nnntEJECUTA EL PROGRAMA NUEVAMENTE?? [SI=1][NO=0]: "); 
-    scanf("%d",&Sigue); 
-   } 
-   else 
-   {printf("nnERROE DIGITE UNA OPCION VALIDA.");} 
-  }while(Sigue!=0); 
- } 
-   
-