');
sound(zvuk); delay(del); nosound;
readln; close(g);
halt;
End;

Procedure DAl;
Begin
writeln;
textcolor(14);
writeln(' Этап пройден успешно.');
textcolor(15);

readln; clrscr;
End;

Procedure leksika;
Begin

writeln(' 3 этап- Лексический анализ...');
writeln('> Проверка на присутствие недопустимых комбинаций знаков');

{удаляем ВСЕ пробелы из строки}
for i:= 1 to dlina do if b[i]<>' ' then s1:=s1+b[i];
writeln(s1);
dlina1:=length(s1);

{проверяем присутствие ошибочных комбинаций символов }
for i:=1 to dlina do begin
IF (

{повторяющиеся знаки}
((s1[i]='+') and (s1[i+1]='+')) or
((s1[i]='-') and (s1[i+1]='-')) or
((s1[i]='=') and (s1[i+1]='=')) or
((s1[i]=';') and (s1[i+1]=';')) or

((s1[i]='[') and (s1[i+1]='[')) or
((s1[i]=']') and (s1[i+1]=']')) or
{комбинации разных знаков }
((s1[i]='[') and (s1[i+1]='=')) or
((s1[i]='=') and (s1[i+1]='[')) or

((s1[i]='[') and (s1[i+1]=';')) or
((s1[i]=';') and (s1[i+1]='[')) or

((s1[i]='[') and (s1[i+1]=':')) or
((s1[i]=':') and (s1[i+1]='[')) or

((s1[i]=']') and (s1[i+1]=':')) or
((s1[i]=':') and (s1[i+1]=']')) or

((s1[i]='[') and (s1[i+1]='.')) or
((s1[i]='.') and (s1[i+1]='[')) or

((s1[i]='+') and (s1[i+1]='[')) or

{}
((s1[i]=']') and (s1[i+1]='=')) or
((s1[i]='=') and (s1[i+1]=']')) or

((s1[i]=';') and (s1[i+1]=']')) or

((s1[i]=']') and (s1[i+1]='.')) or
((s1[i]='.') and (s1[i+1]=']')) or

((s1[i+1] in c) and (s1[i]='.') and (s1[i-1] in bukva)) or
((s1[i+1] in c) and (s1[i]='.') and (s1[i-1] in bukva2)) or

((s1[i+1] in c) and (s1[i]='.') and
(s1[i-1] in c) and ((s1[i-2]='+') or (s1[i-2]='-'))) or

((s1[i]=']') and (s1[i+1]='+')) or
((s1[i]='+') and (s1[i+1]=']')) or

((s1[i]=']') and (s1[i+1]='-')) or
((s1[i]='-') and (s1[i+1]=']')) or
{}
((s1[i]='=') and (s1[i+1]=';')) or
((s1[i]=';') and (s1[i+1]='=')) or

((s1[i]='+') and (s1[i+1]='=')) or
((s1[i]='=') and (s1[i+1]='+')) or

((s1[i]=';') and (s1[i+1]='+')) or
((s1[i]='+') and (s1[i+1]=';')) or

((s1[i]=';') and (s1[i+1]='-')) or
((s1[i]='-') and (s1[i+1]=';')) or

((s1[i]='-') and (s1[i+1]='+')) or
((s1[i]='+') and (s1[i+1]='-')) or

((s1[i]='-') and (s1[i+1]='=')) or

((s1[i]='=') and (s1[i+1]='.')) or
((s1[i]='.') and (s1[i+1]='=')) or

((s1[i]='+') and (s1[i+1]='.')) or

((s1[i]='-') and (s1[i+1]='.')) or

((s1[i]=';') and (s1[i+1]='.')) or
((s1[i]='.') and (s1[i+1]=';'))
)

OR {AND?}
{комбинация ::= ::X :X= X:= где X-любой символ}
(
((s1[i]=':') and (s1[i+1]=':') and (s1[i+2]<>'=')) or
((s1[i]=':') and (s1[i+1]<>':') and (s1[i+2]='=')) or
((s1[i]='.') and (s1[i+1]<>'.') and (s1[i+2]='.')) { .X. }

)
then Netl;
end; {for}

{комбинация цифра' 'цифра - не допустима}
for i :=1 to dlina do
if
(
(s1[i] in c) and {(not (s1[i+1] in c)) and (s1[i+2] in c)) and }
((s1[i+1]=' ') and (s1[i+2]<>' ')) or
((s1[i+1]<>' ') and (s1[i+2]=' '))

)
and (s1[i+1]<>'.')
then NETl;

DAl;
End;

HeU3BecN0cTb HeU3BecN0cTb    1   18.07.2021 23:44    1

Другие вопросы по теме Информатика