а ним термінал}
Begin
tmp.Name: = term;
mj: = Search (Trm_notTrm, tmp);
Ex: = matrixprecede [mi, mj] = 0;
If not Ex Then
matrixprecede [mi, mj]: = 4
Else
matrixprecede [mi, mj]: = 3;
p: = RTN;
Seek (term2, RTN, p);
While (P <> Nil) and (p ^. Name <> # 0) Do
Begin
tmp.Name: = p ^. Name;
mi: = Search (Trm_notTrm, tmp);
Ex: = matrixprecede [mi, mj] = 0;
If not Ex Then
matrixprecede [mi, mj]: = 4
Else
matrixprecede [mi, mj]: = 2;
p: = p ^. Next;
End;
End
Else
If i> Len Then Goto Next
Else
If s [i] = '|' Then
Begin
inc (i);
Goto More;
End;
Blank;
If s [i] = '|' Then
Begin
inc (i);
Goto More;
End;
If i <= Len Then {не дійшли до кінця правила}
Begin
i: = i-Length (term);
While s [i] = '' Do dec (i);
Goto More;
End;
End
Else
Begin
Terminal (term);
tmp.Name: = term;
mi: = Search (Trm_notTrm, tmp);
Blank;
If i> Len Then {останній у правилі термінал}
Goto Next;
If s [i] = '<' Then {за терміналом слід нетермінал}
Begin
inc (i);
Terminal (term);
tmp.Name: = '<' + term + '>';
mj: = Search (Trm_notTrm, tmp);
{Записуємо в матрицю =}
Ex: = matrixprecede [mi, mj] = 0;
If not Ex Then
matrixprecede [mi, mj]: = 4
Else
matrixprecede [mi, mj]: = 3;
p: = LTN;
Seek (tmp.Name, LTN, p);
While (P <> Nil) and (p ^. Name <> # 0) Do
Begin
tmp.Name: = p ^. Name;
mj: = Search (Trm_notTrm, tmp);
Ex: = matrixprecede [mi, mj] = 0;
If not Ex Then
matrixprecede [mi, mj]: = 4
Else
matrixprecede [mi, mj]: = 1;
p: = p ^. Next;
End;
Blank;
inc (i);
Blank;
If s [i] = '|' Then
Begin
inc (i);
Goto More;
End;
If i <= Len Then {не дійшли до кінця правила}
Begin
i: = i-Length (term) -2;
Goto More;
End;
End
Else
If i
Begin
If s [i] = '|' Then
Begin
inc (i);
Goto More;
End;
{за терміналом термінал}
tmp.Name: = term;
mi: = Search (Trm_notTrm, tmp);
Terminal (term);
tmp.Name: = term;
mj: = Search (Trm_notTrm, tmp);
Ex: = matrixprecede [mi, mj] = 0;
If not Ex Then
matrixprecede [mi, mj]: = 4
Else
matrixprecede [mi, mj]: = 3;
i: = i-Length (term);
...