[Oberon] Conditional compilation using IF const THEN
Andreas Pirklbauer
andreas_pirklbauer at yahoo.com
Sun Aug 12 13:59:39 CEST 2018
> A) add code to only parse. Something like a clever SkipUntilMatchingEnd(). It has to handle nesting.
> B) influence code generation if the IF-condition is constant. Not very elegant code ..
This is, perhaps, one of the reasons why the IF optimization has not been carried forward
from the previous (multi-pass) compilers to the (first) single-pass M2 compiler back in ’84.
If someone forced me to introduce the IF optimization, I’d probably pick variant A. At
least then one can “offload/hide the inelegance" to SkipUntilMatchingEnd..
Generally though, I believe this would be optimization at the wrong place. The compiler is not
not here to correct bad programming habits.
And if I really wanted to implement *conditional compilation*, I would not use the IF language
construct for that, but something else, e.g. a compiler directive #IF or something. Not great
either IMHO. And of course not common at all in Wirthian compilers, to say the least..
More information about the Oberon
mailing list