[Oberon] Conditional compilation using IF const THEN
Chris Burrows
chris at cfbsoftware.com
Sat Aug 11 10:09:37 CEST 2018
> -----Original Message-----
> From: Oberon [mailto:oberon-bounces at lists.inf.ethz.ch] On Behalf Of
> Andreas Pirklbauer
> Sent: Saturday, 11 August 2018 5:06 PM
> To: ETH Oberon and related systems
> Subject: [Oberon] Conditional compilation using IF const THEN
>
> > I have tried to work out how the authors of ETH-M2 and GPCP
> > achieved this but have been unsuccessful so far.
>
> First, note that the ETH Modula-2 compilers has seen multiple re-
> implementations over the years. As hardware with more and more RAM
> became available, the number of passes was reduced.
> That s a topic in and by itself, but only of historic interest.
>
Yes - I have the historical interest. I've been trying to get hold of a copy of the source of Wirth's single-pass Lilith Modula-2 compiler for the last 10 years! I don't suppose you'd know any squirrels who might have get a copy?
>
> A. Here is an excerpt of Pass3 of the ETH Modula-2 Multi-Pass
> Compiler in the Lilith implementation Version C18 of 10.02.82:
>
> PROCEDURE IfStatement;
> ...
> BEGIN (*IfStatement*)
> jumpList := NIL;
> LOOP Expression(lat);
> IF lat.mode=constantMod THEN
> IF BOOLEAN(lat.value) THEN (*<-------*)
> StatSeq3(endsy, elsifsy, elsesy);
> IF sy<>endsy THEN Skip(endsy, endsy) END;
> EXIT
> ELSE Skip(elsesy, elsifsy);
> IF sy <> elsifsy THEN EXIT END;
> GetSymbol
> END
>
Thanks for tracking that down for me..
> I have no way to check this today (no access to Lilith ;-), but I
> believe* this is what is happening.
>
You *can* have access to Lilith if you want it. Only a week or so ago I was experimenting with compiling the sources of the MacMeth version of Wirth's single-pass compiler on a Lilith. Well - actually it is a Lilith emulator, an amazing piece of software called EmuLith written by Jos Dreesen (who has a real Lilith):
ftp://ftp.dreesen.ch/Emulith/
It is emulating at the microcode level.
As well as the Emulith software there is a lot of Lilith hardware related material, photos, schematics, disk images that you can download. The software sources include 'microcode.txt', the microcode for
M-CODE INTERPRETER .
BOOTSTRAP/DUMP .
DISPLAY HANDLING PROCEDURES .
REAL OPERATIONS
and a microcode assembler. Awesome.
All of this makes it all the more amazing what Wirth & Co achieved at the time when using the real Lilith especially as the hardware was temperamental by all accounts.
> To replicate that on Project Oberon on RISC you d need to adjust
> ORP.StatSequence accordingly and check the x after Expression(x)
> whether it is a boolean constant.
>
> a) BOOLEAN converts lat.value
>
> (in M2 on Lilith the field lat is an attribute and a
> descriptor of the operand in an expression,
> in Project Oberon it would correspond to x.a)
>
> b) The IF BOOLEAN(lat.value) THEN expression
> then becomes either IF TRUE or IF FALSE
>
> c) If it is FALSE, then Skip(elsesy, elsifsy) is
> executed (see above code), i.e. NO code is generated.
>
> Again, I have no way to check, but I believe that this
> *may* be the way it was done.
>
Great! Thank you very much!
Regards,
Chris
CFB Software
http://www.cfbsoftware.com/modula2
More information about the Oberon
mailing list