Ver Mensaje Individual
  #1  
Antiguo 27-05-2014
Mantixd Mantixd is offline
Miembro
NULL
 
Registrado: dic 2013
Posts: 17
Reputación: 0
Mantixd Va por buen camino
Verificar Sintaxis

Hola buenas, estoy realizando un tipo analizador sintactico para mi carrera de ing. y pues nuestra maestra nos dijo haganlo como puedan y pues estoy haciendolo en delphi solo que tengo un pequeño problema, mi codigo analiza la sintaxis del lenguaje ensamblador y pues verifica que este correcta o no, llevo esto:

Código Delphi [-]

  RegAsm : Array[1..30] of string = ('AX','BX','CX','DX','AH','AL',
                                     'BH','BL','BP','CH','CL','CS',
                                     'DH','DL','DI','DS','GS','IP',
                                     'SI','SP','SS','ES',
                                     'EAX','EBP','EBX','ECX',
                                     'EDI','EDX','EIP','ESIFE');

SL := TStringList.Create;

   for i := 0 to RichEdit1.Lines.Count - 1 do
   begin

      AuxStr := RichEdit1.Lines[i];

      for j := 1 to Length(AuxStr) do
      begin
         if (AuxStr[j] <> ' ') then
            Token := Token + AuxStr[j]
         else
         begin
            SL.Add(Token);
            Token := EmptyStr;
         end
      end;

      SL.Add(Token);
      Token := EmptyStr;

      for j := 0 to SL.Count - 1 do
         for k := Low(RegAsm) to High(RegAsm) do
          if SL[0] = ('mov') then
          begin
          if UpperCase(SL[1]) = UpperCase(RegAsm[k]) then
          begin
          for o := Low(RegAsm) to High(RegAsm) do
          if SL[2] = (',') then
          begin
           if UpperCase(SL[3]) = UpperCase(RegAsm[o]) then
              Memo2.Text:=RichEdit1.Text


             end;
          end;
             end;


           // else
           // begin



      SL.Clear;

   end;

   SL.Free;

mando el contenido del richedit al memo2 como prueba para ver si en vdd lo hace

Pero este codigo no me sirve de mucho porque solo valida el primer renglon del RichEdit mi duda es como hacer que si yo pongo un segundo o tercer renglon tambien verifique que sea correcto y no solo el primero, saludos espero puedan ayudarme
Responder Con Cita