[Oberon] Understanding ORS.Mod.txt

Srinivas Nayak sinu.nayak2001 at gmail.com
Sun Jun 12 15:41:09 CEST 2016


We see

   PROCEDURE Ten(e: LONGINT): REAL;

     VAR x, t: REAL;

   BEGIN x := 1.0; t := 10.0;

     WHILE e > 0 DO

       IF ODD(e) THEN x := t * x END ;

       t := t * t; e := e DIV 2

     END ;

     RETURN x

   END Ten;

Should it be, RETURN x * t ?


With thanks and best regards,

Yours sincerely,
Srinivas Nayak

Home: http://www.mathmeth.com/sn/
Blog: http://srinivas-nayak.blogspot.in/

On 06/12/2016 07:01 PM, Srinivas Nayak wrote:
> Dear Friends,
>
> Finally I could gather my courage to read NW's compiler implementation.
> Hope to get your help when I get doubts.
>
> In ORS.Mod.txt we see
>
>    PROCEDURE Mark*(msg: ARRAY OF CHAR);
>
>      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)
>
>      END ;
>
>      INC(errcnt); errpos := p + 4
>
>    END Mark;
>
> Why we did, errpos := p + 4 ?
> How do I understand/interpret this?
> I was thinking, it should be errpos := p + 1 ...
> Kindly correct me.
>
>
> With thanks and best regards,
>
> Yours sincerely,
> Srinivas Nayak
>
> Home: http://www.mathmeth.com/sn/
> Blog: http://srinivas-nayak.blogspot.in/


More information about the Oberon mailing list