[Oberon] Re (n): syntax in BB, CP, GPCP and V4 ...

Dieter d.gloetzel at web.de
Tue Jul 25 15:07:07 CEST 2017


The source code and docu is in the attachment of my last mail.

Regards, Dieter

Am 25.07.2017 um 14:18 schrieb Jan de Kruyf:
> Would you have the source code for the *.Mod files Dieter?
>
> Jan.
>
>
> On Tue, Jul 25, 2017 at 10:00 AM, Dieter <d.gloetzel at web.de 
> <mailto:d.gloetzel at web.de>> wrote:
>
>     Just to remind you, that there exists a nice prettyprinter written
>     by G. Feldmann, running on ETHOberon Windows plugin.
>     Regards,
>     Dieter
>
>
>     Am 25.07.2017 um 01:44 schrieb Hans Klaver:
>>     Jörg wrote:
>>
>>>     Indentation is indeed a totally personal thing.
>>
>>     It is interesting to catalogue the different indentation styles
>>     used by some well known (and less well known) programmers of
>>     Oberon and Component Pascal source code. With one of the
>>     exercises of the Reiser & Wirth book as material I wrote out
>>     various indentation styles.
>>
>>     Crudely four styles of indentation can be discerned:
>>     - No indentation (Daniel)
>>     - Minimal indentation (Reiser / Mössenböck); the difference
>>     between the two is in the indentation of declarations (e.g. VAR)
>>     at the procedure level
>>     - Classical indentation (Wirth & Gutknecht); has the most
>>     consistent indentation of scope levels.
>>     - Knuth indentation (Knuth / Campbell); also quite consistent,
>>     but rather convoluted.
>>
>>
>>     MODULE M;  (* After Exercise 6.4 (p. 85) from Reiser & Wirth,
>>     Programming in Oberon *)
>>     IMPORT Out;
>>     VAR i, j: INTEGER;
>>     PROCEDURE A*;
>>     VAR i: INTEGER;
>>     PROCEDURE B(VAR i, j: INTEGER);
>>     VAR k: INTEGER;
>>     BEGIN k := i; i := j; j := k END B;
>>     BEGIN i := 2; B(i, j)
>>     END A;
>>     PROCEDURE C*;
>>     BEGIN A; i := 2*j;
>>     Out.Int(i, 5); Out.Int(j, 5); Out.Ln
>>     END C;
>>     BEGIN
>>     END M.C
>>
>>     (**************************************)
>>
>>     MODULE M;  (* Daniel,
>>     http://www.waltzballs.org/other/prog.html#track
>>     <http://www.waltzballs.org/other/prog.html#track> *)
>>     IMPORT Out;
>>     VAR i,j:INTEGER;
>>
>>     PROCEDURE A*;
>>     VAR i:INTEGER;
>>
>>     PROCEDURE B(VAR i,j:INTEGER);
>>     VAR k:INTEGER;
>>     BEGIN k:=i;i:=j;j:=kEND B;
>>
>>     BEGIN i:=2;B(i,j)
>>     END A;
>>
>>     PROCEDURE C*;
>>     BEGIN A;i:=2*j;
>>     Out.Int(i,5);Out.Int(j,5);Out.Ln
>>     END C;
>>
>>     BEGIN
>>     END M.C
>>
>>     (**************************************)
>>
>>     MODULE M;  (* M. Reiser, The Oberon System
>>          and M. Reiser & N. Wirth, Programming in Oberon *)
>>     IMPORT Out;
>>     VAR i, j: INTEGER;
>>
>>     PROCEDURE A*;
>>     VAR i: INTEGER;
>>
>>         PROCEDURE B(VAR i, j: INTEGER);
>>         VAR k: INTEGER;
>>         BEGIN
>>             k := i; i := j; j := k
>>         END B;
>>
>>     BEGIN
>>         i := 2; B(i, j)
>>     END A;
>>
>>     PROCEDURE C*;
>>     BEGIN
>>         A; i := 2*j;
>>         Out.Int(i, 5); Out.Int(j, 5); Out.Ln
>>     END C;
>>
>>     BEGIN
>>     END M.C
>>
>>     (*************************************)
>>
>>     MODULE M;  (* H. Mössenböck, Object Oriented Programming in
>>     Oberon-2 *)
>>     IMPORT Out;
>>     VAR i, j: INTEGER;
>>
>>     PROCEDURE A*;
>>         VAR i: INTEGER;
>>
>>         PROCEDURE B(VAR i, j: INTEGER);
>>             VAR k: INTEGER;
>>         BEGIN
>>             k := i; i := j; j := k
>>         END B;
>>
>>     BEGIN
>>         i := 2; B(i, j)
>>     END A;
>>
>>     PROCEDURE C*;
>>     BEGIN
>>         A; i := 2*j;
>>         Out.Int(i, 5); Out.Int(j, 5); Out.Ln
>>     END C;
>>
>>     BEGIN
>>     END M.C
>>
>>     (**************************************)
>>
>>     MODULE M;  (* Wirth & Gutknecht, Project Oberon *)
>>         IMPORT Out;
>>         VAR i, j: INTEGER;
>>
>>         PROCEDURE A*;
>>             VAR i: INTEGER;
>>
>>             PROCEDURE B(VAR i, j: INTEGER);
>>                 VAR k: INTEGER;
>>             BEGIN
>>                 k := i; i := j; j := k
>>             END B;
>>
>>         BEGIN
>>             i := 2; B(i, j)
>>         END A;
>>
>>         PROCEDURE C*;
>>         BEGIN
>>             A; i := 2*j;
>>             Out.Int(i, 5); Out.Int(j, 5); Out.Ln
>>         END C;
>>
>>     BEGIN
>>     END M.C
>>
>>     (**************************************)
>>
>>     MODULE M;  (* Knuth. E.g. see: http://brokestream.com/tex.pdf *)
>>         IMPORT Out;
>>         VAR i, j: INTEGER;
>>
>>         PROCEDURE A*;
>>             VAR i: INTEGER;
>>
>>             PROCEDURE B(VAR i, j: INTEGER);
>>                 VAR k: INTEGER;
>>                 BEGIN k := i; i := j; j := k
>>                 END B;
>>
>>             BEGIN i := 2; B(i, j)
>>             END A;
>>
>>         PROCEDURE C*;
>>             BEGIN A; i := 2*j;
>>             Out.Int(i, 5); Out.Int(j, 5); Out.Ln
>>             END C;
>>
>>         BEGIN
>>         END M.C
>>
>>     (**************************************)
>>
>>     MODULE M;  (* R. Campbell, Subsystem Lib for BlackBox Component
>>     Framework,
>>        see the Component Pascal Collection, http://www.zinnamturm.eu/ *)
>>     IMPORT Out;
>>     VAR
>>         i, j : INTEGER;
>>
>>     PROCEDURE A*;
>>         VAR
>>             i  : INTEGER;
>>
>>         PROCEDURE B(VAR i, j : INTEGER);
>>             VAR
>>                 k  : INTEGER;
>>             BEGIN
>>                 k := i;  i := j;  j := k
>>             END B;
>>
>>         BEGIN
>>             i := 2;
>>             B(i, j)
>>         END A;
>>
>>     PROCEDURE C*;
>>         BEGIN
>>             A;
>>             i := 2*j;
>>             Out.Int(i, 5);  Out.Int(j, 5);  Out.Ln
>>         END C;
>>
>>     BEGIN
>>     END M.C
>>
>>
>>     Anyone can choose his or her favourite indentation style.
>>
>>     I personally don't like the two extremes (Daniel and Knuth /
>>     Campbell). Imho they don't follow Einstein's criterium "Make it
>>     as simple as ...": Daniel's is too simplistic and Knuth's /
>>     Campbell's are too convoluted.
>>
>>     The classic Wirth / Gutknecht style is the only style that is
>>     completely consistent: every scope has its own indentation.
>>     BlackBox uses this style as standard. See:
>>     https://hansklav.home.xs4all.nl/ProgrammingConventionsBB.pdf
>>     <https://hansklav.home.xs4all.nl/ProgrammingConventionsBB.pdf>
>>
>>     Some might find the Reiser / Mössenböck styles more aesthetically
>>     pleasing because of their simplicity. Although these styles are
>>     not as consistent as the Wirth / Gutknecht style, in practice
>>     this doesn't matter much because there is only one module scope
>>     per compilation unit, and nested procedures are rarely used in
>>     Oberon programs.
>>
>>     The latter styles are used in two excellent books: /The Oberon
>>     System/ by Martin Reiser and /Object-Oriented Programming in
>>     Oberon-2/ by Hanspeter Mössenböck. These books are the two best
>>     typeset Oberon books there are (imho). Unfortunately both have
>>     long been out of print. A scanned copy of /The Oberon System/ can
>>     be found on the internet here:
>>     http://oberoncore.ru/library/reiser_the_oberon_system_user_guide_and_programmers_manual
>>     <http://oberoncore.ru/library/reiser_the_oberon_system_user_guide_and_programmers_manual> ,
>>     and there's a pdf-version of /OOP in Oberon-2/ here:
>>     http://ssw.jku.at/Research/Books/Oberon2.pdf
>>     <http://ssw.jku.at/Research/Books/Oberon2.pdf> . In this pdf the
>>     source code indentation is not rendered entirely accurately, so
>>     also have look at a scanned version of this book:
>>     https://books.google.nl/books?id=BseoCAAAQBAJ&printsec=frontcover&dq=object+oriented+programming+in+oberon-2&hl=nl&sa=X&redir_esc=y#v=onepage&q=object%20oriented%20programming%20in%20oberon-2&f=false
>>     <https://books.google.nl/books?id=BseoCAAAQBAJ&printsec=frontcover&dq=object+oriented+programming+in+oberon-2&hl=nl&sa=X&redir_esc=y#v=onepage&q=object%20oriented%20programming%20in%20oberon-2&f=false>
>>
>>     --
>>     Hans Klaver
>>
>>
>>
>>
>>
>>
>>
>>     --
>>     Oberon at lists.inf.ethz.ch <mailto:Oberon at lists.inf.ethz.ch>  mailing list for ETH Oberon and related systems
>>     https://lists.inf.ethz.ch/mailman/listinfo/oberon
>>     <https://lists.inf.ethz.ch/mailman/listinfo/oberon>
>
>     -- 
>     ____________________________________
>     Dr. Dieter Glötzel
>     Im Rosengarten 27
>     64367 Mühltal
>     Tel.: 06151 / 360 82 72
>
>     -- Oberon at lists.inf.ethz.ch <mailto:Oberon at lists.inf.ethz.ch>
>     mailing list for ETH Oberon and related systems
>     https://lists.inf.ethz.ch/mailman/listinfo/oberon
>     <https://lists.inf.ethz.ch/mailman/listinfo/oberon> 
>
> --
> Oberon at lists.inf.ethz.ch mailing list for ETH Oberon and related systems
> https://lists.inf.ethz.ch/mailman/listinfo/oberon

-- 
____________________________________
Dr. Dieter Glötzel
Im Rosengarten 27
64367 Mühltal
Tel.: 06151 / 360 82 72
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.inf.ethz.ch/pipermail/oberon/attachments/20170725/c383693a/attachment.html>


More information about the Oberon mailing list