mirror of
https://github.com/vishapoberon/compiler.git
synced 2026-04-06 14:32:24 +00:00
PO 2013 compiler for Wirth's RISC processor now can be compiled with voc
Former-commit-id: edf0df4cbf
This commit is contained in:
parent
0e5d1c3ca8
commit
bc8c90fb84
6 changed files with 253 additions and 71 deletions
|
|
@ -1,5 +1,5 @@
|
|||
MODULE ORS; (* NW 19.9.93 / 10.10.2013 Scanner in Oberon-07*)
|
||||
IMPORT SYSTEM, Texts, Oberon;
|
||||
IMPORT SYSTEM, Texts := CmdlnTexts, Console, S := SYSTEM;
|
||||
|
||||
(* Oberon Scanner does lexical analysis. Input is Oberon-Text, output is
|
||||
sequence of symbols, i.e identifiers, numbers, strings, and special symbols.
|
||||
|
|
@ -60,8 +60,8 @@ MODULE ORS; (* NW 19.9.93 / 10.10.2013 Scanner in Oberon-07*)
|
|||
VAR p: LONGINT;
|
||||
BEGIN p := Pos();
|
||||
IF (p > errpos) & (errcnt < 25) THEN
|
||||
Texts.WriteLn(W); Texts.WriteString(W, " pos "); Texts.WriteInt(W, p, 1); Texts.Write(W, " ");
|
||||
Texts.WriteString(W, msg); Texts.Append(Oberon.Log, W.buf)
|
||||
Console.Ln; Console.String(" pos "); Console.Int(p, 1); Console.Char(" ");
|
||||
Console.String(msg)
|
||||
END ;
|
||||
INC(errcnt); errpos := p + 4
|
||||
END Mark;
|
||||
|
|
@ -166,7 +166,8 @@ MODULE ORS; (* NW 19.9.93 / 10.10.2013 Scanner in Oberon-07*)
|
|||
IF h < maxM THEN k := h ELSE Mark("too many digits*") END ;
|
||||
DEC(e); Texts.Read(R, ch)
|
||||
END ;
|
||||
x := FLT(k);
|
||||
(*x := FLT(k);*)
|
||||
x := S.VAL(REAL, k);
|
||||
IF (ch = "E") OR (ch = "D") THEN (*scale factor*)
|
||||
Texts.Read(R, ch); s := 0;
|
||||
IF ch = "-" THEN negE := TRUE; Texts.Read(R, ch)
|
||||
|
|
@ -272,7 +273,10 @@ MODULE ORS; (* NW 19.9.93 / 10.10.2013 Scanner in Oberon-07*)
|
|||
END Init;
|
||||
|
||||
PROCEDURE EnterKW(sym: INTEGER; name: ARRAY OF CHAR);
|
||||
BEGIN keyTab[k].id := name; keyTab[k].sym := sym; INC(k)
|
||||
BEGIN
|
||||
(*keyTab[k].id := name; *)
|
||||
COPY(name, keyTab[k].id);
|
||||
keyTab[k].sym := sym; INC(k)
|
||||
END EnterKW;
|
||||
|
||||
BEGIN Texts.OpenWriter(W); k := 0; KWX[0] := 0; KWX[1] := 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue