rray [1 .. 5] of string [10] =
('Відкрити', 'Зберегти', 'Запуск', 'Інформація', 'Вихід');
Type
notTerm = ^ List;
List = Record {список терміналів і нетерміналів}
Name: Str10; {термінал або нетермінал}
Next: notTerm;
End;
strBuf = array [1 .. 800] of Char;
matrixPr = array [1 .. 20,1 .. 20] of 0 .. 4;
Var i: Byte; {поточна позиція}
s: String; {поточна рядок}
Len: Byte absolute s;
str_: strBuf; {загальний буфер для тексту}
LenStr: Integer; {усього символів в буфері}
CLine, {кол-во рядків}
y: Byte; {поточна рядок}
CTerm: Byte; {кол-во нетерміналов}
CTrmNotTrm: Byte; {кол-во нетерміналов і терміналів}
notTerminalS: NotTerm; {нетермінали зустрічаються в правих частинах}
notTerminalL: NotTerm; {нетермінали в лівій частині}
Trm_notTrm: NotTerm; {список терміналів і нетерміналів}
LTN: NotTerm; {ліві}
RTN: NotTerm; {праві}
tmp: NotTerm; {тимчасова мінлива}
matrixPrecede: matrixPr;
LenWin: Byte; {ширина вікна}
{$ I Dinamic.inc} {Процедури для роботи з динамічними змінними}
{$ I GraphPr.inc} {Графічний інтерфейс}
{$ I ServFunc.inc} {Додаткові процедури обробки рядка}
{---------------------------------------------- ------------------------------}
Procedure Blank;
(* пропуск керуючих символів і пробілів *)
Begin
While (i <= Len) and (S [i] = # 32) do inc (i);
End;
{}
Function Let (s: Char): Boolean;
(* контроль букв *)
Begin
Let: = ((s)> = 'A') and ((s) <= 'Z') or (s in RusLetters);
End;
{}
Function Dig (S: Char; Var n: Byte): Boo lean;
(* контроль цифр *)
Begin
If (s> = '0 ') and (S <= '9 ') Then
Begin
n: = ord (s) -48;
Dig: = true
End
Else Dig: = false
End;
{}
Function Terminal (Var term: String): Boolean;
(* пошук терміналу *)
Begin
term: ='';
If i <= Len Then
While (i <= Len) and (S [i] in Digits + LatLetters + Punctuation + Service + RusLetters)
and not (S [i] = '<') and not (s [i] = '>') and not (s [i] = '|') Do
Begin
term: = term + s [i];
inc (i);
End;
Terminal: = term> ''; p> End;
{}
Function notTerminal (Var term: String): Boolean;
(* пошук нетермінала *) p> Var
j: word;
n: Byte;
Ex: Boolean;
Begin
Blank;
j: = i;
term: ='';
Ex: = True;
If i <= Length (s) Then
If Let (S [i]) Then
Begin
While (I <= Length (s)) and Let (S [i]) ...