..

( : .. " " // , 1997, N.5, .33-35.)

( : .. " " // , 1995, N.3, .3-8.)

e-mail: kuroch@ccas.ru


.

- () G(V,T,P,S), V- , T- , P- , p:a0->a1...al, S-.
AG(G,X,F)- - G, :
1. a V Xa X x1,x2,..., . 2. p:a0->a1...al P Fp y=f(x...), a0,a1,...al, p, x... a0,a1,...al .
, -, - , .
. X,Y,Z,... x,y,z,... . X ( , - ):
x- X ,
- ; , x ( ) .
b- ; , x () . , "" , , "". b =0, .
c- . c=true , . ( , - ) c=0 . c=1, , , b=1.
n- , 0,1 2, , .
f- , , null, .
. Y->X , y x, .. y=f(..x..). : , , . , , - . , . ( ). , , " " " ". :
Y->X, Y X, , y x: y=f(..x..), , y, Y.b=0.
Y->X , y x: y=f(..x..), x (X.a=1), y (Y.a=0), y (Y.b=1), .. .
, Y X, , y x, x ? (X.a=0), y (Y.b=1), (, y).


.

( , , , ). - . p: U0->U1...Uk .

(p):

1. Uj (j=0,1...k) , X, x Uj. X.f=null; X.a=false; x , X.b=X.c=true, X.b=X.c=false. Uj , X.n=1 X.n=2.
2. p y=f(x1...xm) (Y,f,X1...Xm), , , y, .
3. x Uj (j=0,1...k) X.n:=X.n-1.
4. x Uj (j=0,1...k) -(X), X, , , "" X. ( "" "" , , .) .

(Y,f,X1...Xm):

1. Y f: Y.f:=f
2. i=1...m Y->Xi ( - Y->Xi).
3. Y.b=false, (.. y ).
4. (Y), , Y, Y.
105. (Y), , Y.
.

(Y).

( , Y.b=1):
1. Y Y->X
1.1. X.b=false, X.b:=true, 1.3.
1.2. X.f/=null X.a=false, (X).
1.3. X.a=true, Y->X , ( X.a=false) .
2. Y (.. ), y, Y.a=true, Y Y->X -(X), .. , , Y.
.

(Y):

1. Y.a=true Y Z->Y,
1.1. .
1.2. Z , z, Z.a=true, Z Z->X, -(X).
1.3. (Z).
.

-(X).

( , ):

X.a=true, X.c=false, X.n=0,
X ( , X.a=true),
X .

-(Y).

( ):

Y.n=0, Y.c=false,
Y ,
( !) Y->X Y->X, -(X) Y.

, () . X, X.c=true, ("" ).


( 6.0-7.0)

 
 
Unit TrTyp;
{       }
Interface
 
 {  }
 const
 {      }
 MaxNumAttributes = 10;
 
 {   - }
 MaxNumSuccessors = 10;
 
 {     ,   }
 MaxNumArguments = 10;
 
 
{   }
type
 
 {   }
 AttCategory = (Synth,Inh);
 
 {    }
 PAttribute = ^TAttribute;
 
 {     }
 PNode = ^TNode;
 
 {    -   ( ,  ) }
 RelArg = record
 NoNode : integer;
 NoAtr : integer;
 end;
 
 {    }
 TColor = (black,blue,green,red);
 
 {   }
 ColEdge = record
 target : PAttribute;
 color : TColor;
 end;
 
 
 {    }
 TAttribute = Object
 
 {   (  ) }
 cat: AttCategory;
 
 {    }
 out: Boolean;
 
 {    ,      }
 nod: PNode;
 
 {      }
 its_num : integer;
 
 {  ,       }
 arguments: array [1..MaxNumArguments] of RelArg;
 
 {      }
 NumArgs: integer;
 
 {---   ,    , }
 {    }
 
 {       }
 drawn: Boolean;
 
 {     }
 a: Boolean;
 
 {       }
 b: Boolean;
 
 {     }
 c: Boolean;
 
 {      }
 n: integer;
 
 {     }
 f: Boolean;
 
 {  ,     }
 edges: array[1..MaxNumArguments] of ColEdge;
 
 {    ,       }
 dep_attrs: array [1..MaxNumAttributes*(2*MaxNumSuccessors+1)] of PAttribute;
 
 {  }
 constructor Create;
 
 end;
 
 {    }
 TNode = object
 
 {      }
 Attributes: array[1..MaxNumAttributes] of PAttribute;
 
 {   - }
 parent: PNode;
 
 {   - }
 successors: array[1..MaxNumSuccessors] of PNode;
 
 { , ,       }
 passed: array[1..MaxNumSuccessors] of Boolean;
 
 {      }
 examined: Boolean;
 
 {    }
 terminal: Boolean;
 
 {  }
 constructor Create;
 
 {        }
 function NumAttrs: integer; virtual;
 
 {         }
 function NumSuccesrs: integer; virtual;
 
 { ,    j }
 procedure Evaluate(j: integer); virtual;
 
 end;
 
Implementation
 
constructor TAttribute.Create;
begin {...} end;
 
constructor TNode.Create;
begin {...} end;
 
function TNode.NumAttrs;
begin {...} end;
 
function TNode.NumSuccesrs;
begin {...} end;
 
procedure TNode.Evaluate(j : integer);
begin {...} end;
 
end.
 
{----------------}
 
Unit AttEval;
 
{ ,  ;     }
 
interface
uses TrTyp;
 
procedure att_eval(var UserTree: TNode);
 
implementation
 
procedure del_node(var x: TAttribute);
 var z : Tattribute;
 i,j,l1 : integer;
 NoBlueGreenEdges : Boolean;
 begin
 if ( ( x.a ) and ( not x.c ) and ( x.n = 0 ) ) then
 begin
 {  ,    x       }
 NoBlueGreenEdges := True;
 for i := 1 to MaxNumAttributes*(2*MaxNumSuccessors+1) do
 begin
 if x.dep_attrs[i] <> NIL then z:= x.dep_attrs[i]^;
 for l1 := 1 to z.numargs do
 if ( z.edges[l1].target = @x )
 and
 ( ( z.edges[l1].color = Blue)
 or
 ( z.edges[l1].color = Green) )
 then
 NoBlueGreenEdges := False;
 end {i};
 if NoBlueGreenEdges then x.drawn := False;
 end {if};
 end;
 
procedure del_graph(var y: TAttribute);
 var x,z : Tattribute;
 i,j,l,l1 : integer;
 NoEdges : Boolean;
 begin
 if ( ( y.n = 0 ) and ( not y.c ) ) then
 begin
 {  ,    x     }
 NoEdges := True;
 for i := 1 to MaxNumAttributes*(2*MaxNumSuccessors+1) do
 begin
 if y.dep_attrs[i] <> NIL then z := y.dep_attrs[i]^;
 for l1 := 1 to z.numargs do
 if ( z.edges[l1].target = @x )
 and
 ( z.edges[l1].color <> Black)
 then
 NoEdges := False;
 end {i};
 if NoEdges then
 begin
 for l := 1 to y.numargs do
 if y.edges[l].color = Blue then
 begin
 x := y.edges[l].target^;
 y.edges[l].color := Black;
 Del_Graph(x); {}
 end {l};
 y.drawn := False;
 end {if}
 end {if}
 end {del_graph};
 
procedure Higher(var y: TAttribute);
 
 var z : Tattribute;
 i,l,l1,j1 : integer;
 no_red_edges : Boolean;
 begin
 {h1}
 if y.a then
 begin
 for l:= 1 to MaxNumAttributes*(2*MaxNumSuccessors+1) do
 begin
 if y.dep_attrs[l] <> NIL then z:= y.dep_attrs[l]^;
 for l1 := 1 to z.numargs do
 if ( z.edges[l1].target = @y ) and ( z.edges[l1].color = Red) then
 begin
 {h1.1}
 z.edges[l1].color := Green;
 {h1.2}
 no_red_edges := True;
 for j1 := 1 to z.numargs do
 if z.edges[j1].color = Red then no_red_edges := False;
 if no_red_edges then
 begin
 z.nod^.Evaluate(z.its_num);
 z.a := true;
 for j1 := 1 to z.numargs do
 begin
 z.edges[j1].color := Black;
 del_node(z.edges[j1].target^);
 end {j1}
 end;
 {h1.3}
 Higher(z); {  }
 end {l1-if};
 end {l}
 end {if y.a=1};
 end;
 
 
procedure Lower(var y: TAttribute);
 var x : Tattribute;
 i : integer;
 no_red_edges : Boolean;
 label low_1_3;
 begin
 {l1}
 for i:= 1 to y.NumArgs do
 if y.edges[i].color = Blue then
 begin
 x := y.edges[i].target^;
 {l1.1}
 if x.b = false then x.b := true else goto low_1_3;
 {l1.2}
 if (x.f AND ( x.a = false )) then Lower(x); {  }
 {l1.3}
 low_1_3:
 if x.a = true then
 y.edges[i].color := Green else y.edges[i].color := Red;
 end {i-if};
 {l2}
 no_red_edges := True;
 for i:= 1 to y.NumArgs do
 if y.edges[i].color = Red then no_red_edges := False;
 if no_red_edges then
 begin
 y.nod^.Evaluate(y.its_num);
 y.a := false;
 for i:= 1 to y.NumArgs do
 begin
 y.edges[i].color := Black;
 Del_Node(y.edges[i].target^);
 end;
 end;
 end {lower};
 
 
procedure dependancy (var y: TAttribute);
 var i : integer;
 label finish;
 begin
 {d1}
 y.f := true;
 {d2}
 for i:= 1 to y.NumArgs do
 y.edges[i].color := Blue;
 {d3}
 if y.b = false then goto finish;
 {d4}
 Lower(y);
 {d5}
 Higher(y);
 {}
 finish:
 end {dependancy};
 
 
 
procedure branching (w: TNode);
 var w1,w2 : TNode;
 i,j,l,j1,l1 : integer;
 x1 : TAttribute;
 begin
 { b1 }
 if not w.examined then
 begin
 {    ,    U0 }
 for j:= 1 to w.NumAttrs do
 begin
 w.Attributes[j]^.drawn := true;
 w.Attributes[j]^.f:= False;
 w.Attributes[j]^.a:= False;
 if w.Attributes[j]^.out then
 {   }
 begin
 w.Attributes[j]^.b:= true;
 w.Attributes[j]^.c:= true;
 end
 else
 {   }
 begin
 w.Attributes[j]^.b:= false;
 w.Attributes[j]^.c:= false;
 end;
 {}
 if w.terminal then w.Attributes[j]^.n:= 1 else w.Attributes[j]^.n:= 2;
 end {j};
 w.examined := true;
 end {if};
 
 {    ,    U1-Uk }
 for i := 1 to w.NumSuccesrs do
 begin
 w1:=w.successors[i]^;
 if not w1.examined then
 begin
 for j:= 1 to w1.NumAttrs do
 begin
 w1.Attributes[j]^.drawn := true;
 w1.Attributes[j]^.f:= false;
 w1.Attributes[j]^.a:= false;
 if w1.Attributes[j]^.out then
 {   }
 begin
 w1.Attributes[j]^.b:= true;
 w1.Attributes[j]^.c:= true;
 end
 else
 {   }
 begin
 w1.Attributes[j]^.b:= false;
 w1.Attributes[j]^.c:= false;
 end;
 {}
 if w1.terminal then w1.Attributes[j]^.n:= 1 else w1.Attributes[j]^.n:= 2;
 end {j};
 w1.examined := true;
 end {if};
 end {i};
 
 {b3/2   edges}
 { }
 for j:= 1 to w.NumAttrs do
 if w.Attributes[j]^.cat = Synth then
 for l := 1 to w.Attributes[j]^.NumArgs do
 if w.Attributes[j]^.arguments[l].NoNode = 0 {    }
 then begin
 w.Attributes[j]^.edges[l].target := w.Attributes[w.Attributes[j]^.arguments[l].NoAtr];
 w.Attributes[j]^.edges[l].color := Black;
 {   }
 x1 := w.Attributes[w.Attributes[j]^.arguments[l].NoAtr]^;
 l1 := 0;
 repeat
 l1 := l1 +1
 until x1.dep_attrs[l1] = NIL;
 x1.dep_attrs[l1] := w.Attributes[j];
 {}
 end {then}
 else {      }
 begin
 w1:=w.successors[w.Attributes[j]^.arguments[l].NoNode]^;
 w.Attributes[j]^.edges[l].target := w1.Attributes[w.Attributes[j]^.arguments[l].NoAtr];
 w.Attributes[j]^.edges[l].color := Black;
 {   }
 x1 := w.Attributes[w.Attributes[j]^.arguments[l].NoAtr]^;
 l1 := 0;
 repeat
 l1 := l1 +1
 until x1.dep_attrs[l1] = NIL;
 x1.dep_attrs[l1] := w.Attributes[j];
 {}
 end {else};
 { }
 for i := 1 to w.NumSuccesrs do
 begin
 w1:=w.successors[i]^;
 for j:= 1 to w1.NumAttrs do
 if w1.Attributes[j]^.cat = Inh then
 for l := 1 to w1.Attributes[j]^.NumArgs do
 if w1.Attributes[j]^.arguments[l].NoNode = 0 {    }
 then begin
 w1.Attributes[j]^.edges[l].target := w.Attributes[w1.Attributes[j]^.arguments[l].NoAtr];
 w1.Attributes[j]^.edges[l].color := Black;
 {   }
 x1 := w.Attributes[w1.Attributes[j]^.arguments[l].NoAtr]^;
 l1 := 0;
 repeat
 l1 := l1 +1
 until x1.dep_attrs[l1] = NIL;
 x1.dep_attrs[l1] := w1.Attributes[j];
 {}
 end {then}
 else {      }
 begin
 w2:=w.successors[w.Attributes[j]^.arguments[l].NoNode]^;
 w1.Attributes[j]^.edges[l].target := w2.Attributes[w1.Attributes[j]^.arguments[l].NoAtr];
 w1.Attributes[j]^.edges[l].color := Black;
 {   }
 x1 := w2.Attributes[w1.Attributes[j]^.arguments[l].NoAtr]^;
 l1 := 0;
 repeat
 l1 := l1 +1
 until x1.dep_attrs[l1] = NIL;
 x1.dep_attrs[l1] := w1.Attributes[j];
 {}
 end {else};
 end {i};
 
 {b2}
 for j:= 1 to w.NumAttrs do
 begin
 if w.Attributes[j]^.cat = Synth then
 dependancy(w.Attributes[j]^);
 end {j};
 for i := 1 to w.NumSuccesrs do
 begin
 w1:=w.successors[i]^;
 for j:= 1 to w1.NumAttrs do
 begin
 if w1.Attributes[j]^.cat = Inh then
 dependancy(w1.Attributes[j]^);
 end {j};
 end {i};
 {b3}
 for j:= 1 to w.NumAttrs do
 w.Attributes[j]^.n := w.Attributes[j]^.n -1;
 for i := 1 to w.NumSuccesrs do
 begin
 w1:=w.successors[i]^;
 for j:= 1 to w1.NumAttrs do
 w1.Attributes[j]^.n := w1.Attributes[j]^.n -1;
 end {i};
 {b4}
 for j:= 1 to w.NumAttrs do
 Del_Graph(w.Attributes[j]^);
 for i := 1 to w.NumSuccesrs do
 begin
 w1:=w.successors[i]^;
 for j:= 1 to w1.NumAttrs do
 Del_Graph(w1.Attributes[j]^);
 end {i};
 
 end;
 
 
procedure att_eval(var UserTree: TNode);
 
{       }
 
var w,w1 : TNode;
 i : integer;
begin
 w := UserTree;
 repeat
 if NOT w.examined then begin
 branching(w);
 w.examined := true;
 end;
 if w.passed[w.NumSuccesrs] then
 {  }
 begin
 w1:= w.parent^;
 w:= w1;
 end {then}
 else
 {  }
 begin
 i := 1;
 while w.passed[i] do
 i:= i+1;
 w1:=w.successors[i]^;
 w.passed[i] := true;
 w:= w1;
 end {else};
 until w.parent = NIL;
end {att_eval};
end.
 

..

, . . .

, ( , , LL- LR-). , , -, , - , ( ), , .., -, , .

, . , , , . , (2-5) . , , , . ( 256). , , , . - , , , , . . , . , . (" ") . "" ( ) ( ) , , , , . - , , , , .

. . ( ) , ** , := , >= b .. , , , " " ( ). , , e, el, els, else, elsi, elsif, en, end, ent, entr, entry, ex, exi, exit 2,3,4,5,6,7,12,13,14,15,16,21,22,23, l, n, x 2 3,12,21; s 3 - 4; e , i 4 - 5,6; f 6 - 7; d , t 12 - 13,14 ..; t 22 - 23. , , + , > , "" .., , - . Ada , 63 , 230 .

. . , . , . , , , , ( !), . :

- ( - );

- ( , , , ; - , ; );

- ( - , - ; , );

- ( - ; , , ; , ; - );

- ( , ; , , , .. ).

, real, integer ., ; . , , .. , . , (.. ) , . (, , ). : , .

, , , .


( 7.0)
.
: , res_words.txt , delim.txt . Range Checking.

 
uses crt, DOS;
type
{type of the lexema}
{pointer to row}
prow = ^row;
{row of the table}
row = record
 lextype : string; {type of the lexema}
 n : word; {number of lexema of this type (if defined)}
 contents : string;
 nextrow : array [0..255] of prow;
 end;
{sets jf symbols}
sym_set = set of char;
 
var
 F: Text;
 s: string;
 spec_symbols, letters, ciphers : sym_set;
 pcurr_row, pinit_row, pnew_row : prow;
 i,j, counter_rw,counter_del,counter_ident,counter_const : integer;
 ch : char;
label
 next_symbol,next_line;
 
begin
 spec_symbols := [' ','+','-','*','/','=',',',':',';','<','>','[',']','(',')','{','}','^','@','$','#'];
 letters := ['a'..'z'];
 ciphers := ['0'..'9'];
 
 
{initial row}
 new (pcurr_row);
 pinit_row := pcurr_row;
 pcurr_row^.lextype := '';
 pcurr_row^.contents := '';
 for i := 0 to 32 do
 pcurr_row^.nextrow[i] := pinit_row;
 for i := 33 to 255 do
 pcurr_row^.nextrow[i] := NIL;
 
{reading the list of reserved words}
 assign(F,'c:\tpwork\reswords.txt');
 reset(F);
 counter_rw:=0;
 repeat
 counter_rw := counter_rw + 1;
 pcurr_row := pinit_row;
 readln(F,s);
 writeln(s,' ',length(s));
 for j := 1 to length(s) do
 begin
 if pcurr_row^.nextrow[ord(s[j])] = NIL
 then
 begin
 new (pnew_row);
 pnew_row^.lextype := '';
 for i := 33 to 255 do
 pnew_row^.nextrow[i] := NIL;
 pcurr_row^.nextrow[ord(s[j])] := pnew_row;
 pnew_row^.contents :=pcurr_row^.contents + s[j];
 end
 else
 begin
 pnew_row := pcurr_row^.nextrow[ord(s[j])];
 end;
 pcurr_row := pnew_row;
 {writeln (j,s[j]);}
 end {j};
 writeln(pcurr_row^.contents);
 pcurr_row^.lextype := 'reserv_word';
 pcurr_row^.n := counter_rw;
 until EOF(F);
 
{reading the list of delimiters}
 assign(F,'c:\tpwork\delim.txt');
 reset(F);
 counter_del:=0;
 repeat
 counter_del := counter_del + 1;
 pcurr_row := pinit_row;
 readln(F,s);
 writeln(s,' ',length(s));
 for j := 1 to length(s) do
 begin
 if pcurr_row^.nextrow[ord(s[j])] = NIL
 then
 begin
 new (pnew_row);
 pnew_row^.lextype := '';
 for i := 33 to 255 do
 pnew_row^.nextrow[i] := NIL;
 pcurr_row^.nextrow[ord(s[j])] := pnew_row;
 pnew_row^.contents :=pcurr_row^.contents + s[j];
 end
 else
 begin
 pnew_row := pcurr_row^.nextrow[ord(s[j])];
 end;
 pcurr_row := pnew_row;
 {writeln (j,s[j]);}
 end {j};
 writeln(pcurr_row^.contents);
 pcurr_row^.lextype := 'delimiter';
 pcurr_row^.n := counter_del;
 until EOF(F);
 
 writeln('reading the text of the program:');
{reading the text of the program}
 assign(F,'c:\tpwork\program.txt');
 reset(F);
 counter_ident:=0;
 counter_const:=0;
 repeat
 pcurr_row := pinit_row;
 readln(F,s);
 writeln('next line of the text: ',s,' length: ',length(s));
 for j := 1 to length(s) do
 begin
 
 writeln('s[j],ord(s[j]):',s[j],ord(s[j]));
 
 if pcurr_row^.nextrow[ord(s[j])] <> NIL {continuing already known lexem:}
 then
 begin
 pnew_row := pcurr_row^.nextrow[ord(s[j])];
 writeln('continuing already known lexem');
 writeln('contents:',pcurr_row^.contents,'|');
 pcurr_row := pnew_row;
 end
 
 else {pointer is empty: end of lexem or beginning or continuaton of a new lexem:}
 
 begin
 writeln('pointer is empty: end of a lexem or beginning or continuation of a new lexem');
 writeln('contents:',pcurr_row^.contents,'|');
 
 {end of res_word:}
 if pcurr_row^.lextype = 'reserv_word' then
 begin
 writeln('end of res_word');
 writeln (pcurr_row^.lextype,' ',pcurr_row^.n);
 pcurr_row := pinit_row;
 goto next_symbol;
 end;
 
 {end of delimiter:}
 if pcurr_row^.lextype = 'delimiter' then
 begin
 writeln('end of delimiter');
 writeln (pcurr_row^.lextype,' ',pcurr_row^.n);
 pcurr_row := pinit_row;
 goto next_symbol;
 end;
 
 {end of known identifyer:}
 if (pcurr_row^.lextype = 'identifyer')
 and (not ( (s[j] in (letters + ciphers) ) or (s[j] = #39) ))
 then
 begin
 writeln('end of known identifyer');
 writeln (pcurr_row^.lextype,' ',pcurr_row^.n);
 pcurr_row := pinit_row;
 goto next_symbol;
 end;
 
 
 {beginning of new identifyer:}
 if (pcurr_row^.contents = '') and (s[j] in letters ) then
 begin
 writeln('beginning of new identifyer');
 new (pnew_row);
 pnew_row^.lextype := '';
 for i := 0 to 255 do
 pnew_row^.nextrow[i] := NIL;
 pcurr_row^.nextrow[ord(s[j])] := pnew_row;
 pnew_row^.contents :=pcurr_row^.contents + s[j];
 pcurr_row := pnew_row;
 goto next_symbol;
 end;
 
 {continuation of new identifyer:}
 if (pcurr_row^.contents[1] in letters) and (s[j] in (letters + ciphers)) then
 begin
 writeln('continuation of new identifyer');
 writeln ('contents:',pcurr_row^.contents,'|');
 new (pnew_row);
 pnew_row^.lextype := '';
 for i := 0 to 255 do
 pnew_row^.nextrow[i] := NIL;
 pcurr_row^.nextrow[ord(s[j])] := pnew_row;
 pnew_row^.contents :=pcurr_row^.contents + s[j];
 pcurr_row := pnew_row;
 goto next_symbol;
 end;
 
 {end of new identifyer:}
 if (pcurr_row^.contents[1] in letters) and (s[j] in spec_symbols) then
 begin
 writeln('end of new identifyer');
 counter_ident := counter_ident + 1 ;
 pcurr_row^.lextype := 'identifyer';
 pcurr_row^.n := counter_ident;
 writeln (pcurr_row^.lextype,' ',pcurr_row^.n);
 pcurr_row := pinit_row;
 goto next_symbol;
 end;
 
 
 {end of known constant:}
 if ( pcurr_row^.lextype = 'constant' )
 and (not ( (s[j] in (letters + ciphers) ) or (s[j] = #39) ))
 then
 begin
 writeln('end of known constant');
 writeln (pcurr_row^.lextype,' ',pcurr_row^.n);
 pcurr_row := pinit_row;
 goto next_symbol;
 end;
 
 {beginning of new constant:}
 if (pcurr_row^.contents = '') and ( (s[j] in (letters + ciphers) ) or (s[j] = #39) ) then
 begin
 writeln('beginning of new constant');
 new (pnew_row);
 pnew_row^.lextype := '';
 for i := 0 to 255 do
 pnew_row^.nextrow[i] := NIL;
 pcurr_row^.nextrow[ord(s[j])] := pnew_row;
 pnew_row^.contents :=pcurr_row^.contents + s[j];
 pcurr_row := pnew_row;
 goto next_symbol;
 end;
 
 
 {continuation of new constant:}
 if ( (pcurr_row^.contents[1] in ciphers) or (pcurr_row^.contents[1] = #39) )
 and ( (s[j] in (letters + ciphers) ) or (s[j] = #39) ) then
 begin
 writeln('continuation of new constant');
 new (pnew_row);
 pnew_row^.lextype := '';
 for i := 0 to 255 do
 pnew_row^.nextrow[i] := NIL;
 pcurr_row^.nextrow[ord(s[j])] := pnew_row;
 pnew_row^.contents :=pcurr_row^.contents + s[j];
 pcurr_row := pnew_row;
 writeln('special output: contents:',pcurr_row^.contents,'|');
 goto next_symbol;
 end;
 
 {end of new constant:}
 if ( (pcurr_row^.contents[1] in ciphers) or (pcurr_row^.contents[1] = #39) )
 and (s[j] in spec_symbols) then
 begin
 writeln('end of new constant');
 counter_const := counter_const + 1 ;
 pcurr_row^.lextype := 'constant';
 pcurr_row^.n := counter_const;
 writeln (pcurr_row^.lextype,pcurr_row^.n);
 pcurr_row := pinit_row;
 goto next_symbol;
 end;
 end;
 next_symbol:
 ch := ReadKey;
 end {j};
 {actions at the end of each line of the text}
 {end of res_word:}
 if pcurr_row^.lextype = 'reserv_word' then
 begin
 writeln('end of res_word');
 writeln (pcurr_row^.lextype,' ',pcurr_row^.n);
 pcurr_row := pinit_row;
 goto next_line;
 end;
 
 {end of delimiter:}
 if pcurr_row^.lextype = 'delimiter' then
 begin
 writeln('end of delimiter');
 writeln (pcurr_row^.lextype,' ',pcurr_row^.n);
 pcurr_row := pinit_row;
 goto next_line;
 end;
 
 {end of known identifyer:}
 if pcurr_row^.lextype = 'identifyer' then
 begin
 writeln('end of known identifyer');
 writeln (pcurr_row^.lextype,' ',pcurr_row^.n);
 pcurr_row := pinit_row;
 goto next_line;
 end;
 
 {end of known constant:}
 if pcurr_row^.lextype = 'constant' then
 begin
 writeln('end of known constant');
 writeln (pcurr_row^.lextype,' ',pcurr_row^.n);
 pcurr_row := pinit_row;
 goto next_line;
 end;
 
 {end of new identifyer:}
 if (pcurr_row^.contents[1] in letters) then
 begin
 writeln('end of new identifyer');
 counter_ident := counter_ident + 1 ;
 pcurr_row^.lextype := 'identifyer';
 pcurr_row^.n := counter_ident;
 writeln (pcurr_row^.lextype,' ',pcurr_row^.n);
 pcurr_row := pinit_row;
 goto next_line;
 end;
 
 {end of new constant:}
 if ( (pcurr_row^.contents[1] in ciphers) or (pcurr_row^.contents[1] = #39) )
 then
 begin
 writeln('end of new constant');
 counter_const := counter_const + 1 ;
 pcurr_row^.lextype := 'constant';
 pcurr_row^.n := counter_const;
 writeln (pcurr_row^.lextype,pcurr_row^.n);
 pcurr_row := pinit_row;
 goto next_line;
 end;
 
 next_line:
 
 until EOF(F);
end.

-:

 
absolute
and
array
begin
case
const
div
do
downto
else
end
external
file
for
forward
function
goto
if
implementation
in
inline
interface
interrupt
label
mod
nil
not
of
or
packed
procedure
program
record
repeat
set
shl
shr
string
then
to
type
unit
until
uses
var
while
with
xor
 

- :

 
+
-
*
/
=
,
.
:
;
< 
> 
[
]
(
)
{
}
^
@
$
#
<> 
<=
>=
:=
(*
*)
(.
.)

( 93-12-573 96-01-01757).