[Oberon] Assumed issue in the Lola-2 compiler
joerg.straube at iaeth.ch
Mon Apr 15 03:13:12 CEST 2019
The Lola compiler at https://inf.ethz.ch/personal/wirth/Lola/index.html does not handle CONSTs with length correctly. To enable them you have to add two statements to factor0() in LSC.Mod:
IF sym = LSS.ident THEN
x := ThisObj(LSS.id); LSS.Get(sym);
IF x.tag = LSB.var THEN selector(x)
ELSIF x.tag = LSB.const THEN
n := x.b.val; len := x.b.size;
NEW(x); x.tag := LSB.lit; x.val := n;
x.type := LSB.integer; x.size := len
ELSE LSS.Mark("bad factor") END
ELSIF sym = LSS.lparen THEN
> Am 15.04.2019 um 02:18 schrieb "rochus.keller at bluewin.ch" <rochus.keller at bluewin.ch>:
> Thank you once more for your feedback.
> @ Paul Reed:
>>> if x=-1, then I would assume the result of this assignment would be zero.
>>> Unfortunately, yes.
> Ok, then DIV is not a useful operator for this case. I therefor changed the REPEAT statement like this:
> REPEAT d[i] := x MOD 10H;
> x := ASR(x,4); (* 'x DIV 16' corresponds to ASR(x,4) *)
> UNTIL (x = 0) OR (i = 8);
> I did a couple of tests and think it works as expected. Does this look reasonable to you?
> @ Joerg Straube:
> I hope you don't mind if I respond in English ;-)
> Thanks for the minimized MOD expressions; I will do some tests with them. Currently I assume that my Oberon to C++ translator will just insert _MOD() funktion calls and not prescribe the implementation. I agree that the language report is rather brief and more information would be helpful. But the ' length specification is explicitly mentioned in the text which for me is sufficient to support it; and the reason I spent the effort with the Oberon to C++ translator was that I can use the original Lola compiler source code. It is also easier to recognize the literals in the generated Verilog code if the format doesn't change too much.
> Oberon at lists.inf.ethz.ch mailing list for ETH Oberon and related systems
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Oberon