<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto">The Lola compiler at <a href="https://inf.ethz.ch/personal/wirth/Lola/index.html">https://inf.ethz.ch/personal/wirth/Lola/index.html</a> does not handle CONSTs with length correctly. To enable them you have to add two statements to factor0() in LSC.Mod:<div><font face="UICTFontTextStyleBody"><span style="background-color: rgba(255, 255, 255, 0);"><br></span></font></div><div><font face="UICTFontTextStyleBody"><span style="background-color: rgba(255, 255, 255, 0);">IF sym = LSS.ident THEN</span></font></div><div><span style="background-color: rgba(255, 255, 255, 0);"> x := ThisObj(<a href="http://LSS.id">LSS.id</a>); LSS.Get(sym);</span></div><div><span style="background-color: rgba(255, 255, 255, 0);"> IF x.tag = LSB.var THEN selector(x)</span></div><div><span style="background-color: rgba(255, 255, 255, 0);"> ELSIF x.tag = LSB.const THEN</span></div><div><span style="background-color: rgba(255, 255, 255, 0);"> n := x.b.val; <b>len := x.b.size;</b></span></div><div><span style="background-color: rgba(255, 255, 255, 0);"> NEW(x); x.tag := LSB.lit; x.val := n;</span></div><div><span style="background-color: rgba(255, 255, 255, 0);"> x.type := LSB.integer; </span><b style="background-color: rgba(255, 255, 255, 0);">x.size := len</b></div><div><span style="background-color: rgba(255, 255, 255, 0);"> ELSE LSS.Mark("bad factor")
END</span></div><div><span style="background-color: rgba(255, 255, 255, 0);">ELSIF sym = LSS.lparen THEN</span><div><div><br></div><div><div dir="ltr">br<br><div>Jörg</div></div><div dir="ltr"><br>Am 15.04.2019 um 02:18 schrieb "<a href="mailto:rochus.keller@bluewin.ch">rochus.keller@bluewin.ch</a>" <<a href="mailto:rochus.keller@bluewin.ch">rochus.keller@bluewin.ch</a>>:<br><br></div><blockquote type="cite"><div dir="ltr"><span>Thank you once more for your feedback.</span><br><span></span><br><span>@ Paul Reed:</span><br><blockquote type="cite"><blockquote type="cite"><span>if x=-1, then I would assume the result of this assignment would be zero.</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>Unfortunately, yes.</span><br></blockquote></blockquote><span>Ok, then DIV is not a useful operator for this case. I therefor changed the REPEAT statement like this:</span><br><span> REPEAT d[i] := x MOD 10H; </span><br><span> x := ASR(x,4); (* 'x DIV 16' corresponds to ASR(x,4) *)</span><br><span> INC(i) </span><br><span> UNTIL (x = 0) OR (i = 8);</span><br><span>I did a couple of tests and think it works as expected. Does this look reasonable to you?</span><br><span></span><br><span>@ Joerg Straube:</span><br><span>I hope you don't mind if I respond in English ;-) </span><br><span>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.</span><br><span></span><br><span>Best</span><br><span>R.K.</span><br><span>--</span><br><span><a href="mailto:Oberon@lists.inf.ethz.ch">Oberon@lists.inf.ethz.ch</a> mailing list for ETH Oberon and related systems</span><br><span><a href="https://lists.inf.ethz.ch/mailman/listinfo/oberon">https://lists.inf.ethz.ch/mailman/listinfo/oberon</a></span><br></div></blockquote></div></div></div></body></html>