procedure getch; const tab = 9; begin if eof then begin ch:='.'; theword:=' ' end else if eoln then begin readln; writeln; ch:=' '; lineno:=lineno+1; write(lineno:3, ': ') end else begin read(ch); write(ch); if ord(ch)=tab then ch:=' ' end end{getch}; procedure insymbol; const blank=' '; var len:integer; begin repeat while ch=' ' do getch; if ch='{' then { comment } begin repeat getch until (ch='}') or eof; getch end until not( ch in [' ', '{'] ); if eof then sy:=eofsy else if ch in ['a'..'z', 'A'..'Z'] then {xyz} begin theword:=blank; len:=0; while ch in ['a'..'z', 'A'..'Z', '0'..'9'] do begin len:=len+1; if len<=10 then theword[len] := ch; getch end; {not ch in ['a'..'z', '0'..'9']} if theword='and ' then sy:=andsy else if theword='not ' then sy:=notsy else if theword[1] in ['a'..'z'] then sy:=LCword else sy:=UCword end{alphanums} else if ch in ['0'..'9'] then {123} begin theint:=0; while ch in ['0'..'9'] do begin theint:=theint*10+ord(ch)-ord('0'); getch end; sy:=numeral end else if ch in [ '?', '.', ',', ':', '<', '&', '(', ')', '[', ']' ] then case ch of '<': begin getch; if ch='=' then begin getch; sy:=impliedby end else error('not <= ') end; ':': begin getch; if ch='-' then begin getch; sy:=impliedby end else sy:=colon end; '?', '.', ',', '(', ')', '[', ']', '&': begin case ch of '?': sy:=question; '.': sy:=dot; ',': sy:=comma; '(': sy:=open; ')': sy:=close; '[': sy:=sqopen; ']': sy:=sqclose; '&': sy:=andsy end{case}; getch end end{case} else error('bad symbol') end{insymbol}; {\fB Lexical Analysis. \fP}