Lexikalische Analyse II

 [Vorheriges Kapitel]  [Vorherige Seite]  [Inhaltsverzeichnis]  [Nächste Seite]  [Nächstes Kapitel]

Expr2.om
VAR
   ch: CHAR; (* current input character, 0X in case of eof *)
   eof: BOOLEAN; (* eof seen yet? *)

CONST
   (* terminal symbols *)
   plusSY = 0;
   minusSY = 1;
   multiplySY = 2;
   divideSY = 3;
   lparenSY = 4;
   rparenSY = 5;
   constantSY = 6;
   eofSY = 7;
   errorSY = 8;
VAR
   sy: SHORTINT; (* current input token *)
   const: INTEGER; (* set if sy = constantSY *)

PROCEDURE NextCh;
BEGIN
   IF eof OR ~Streams.ReadByte(s, ch) THEN
      ch := 0X; eof := TRUE;
   END;
END NextCh;

*Neu hinzu kommt jetzt NextCh, das genau ein Zeichen von der Eingabe-Verbindung s einliest.
 
*Genauso wie bei dem aktuellen Terminal-Symbol sy steht immer das nächste Eingabe-Zeichen in der Variablen ch zur Verfügung.
 

 [Vorheriges Kapitel]  [Vorherige Seite]  [Inhaltsverzeichnis]  [Nächste Seite]  [Nächstes Kapitel]
Copyright © 1999 Andreas Borchert, in HTML konvertiert am 29.06.1999