Open GoogleCodeExporter opened 9 years ago
I have the same issue which is major for me. OS engine bugs if a line starts by
a parenthesis (Error CS020: Only assignment, call, increment, decrement, and
new object expressions can be used as a statement).
Wo should have "i = 1;" and not "(i = 1);" in the generated script
//Original script
default {
state_entry() {
integer i;
i = 1;
}
}
// LSL script generated
default {
state_entry() {
integer i;
(i = 1);
}
}
Original comment by kool.mek...@gmail.com
on 16 Nov 2011 at 10:26
I'm fairly sure this is a bug with OpenSim's idea of LSL, since I've run in to
some issues while writing code by hand.
One instance of similar problems was using the (O = []) = ... trick to save
memory when using non-mono scripts; in Linden Mono this worked but isn't
needed, in OpenSim's interpreter it actively corrupted the list.
Original comment by joshua.c...@gmail.com
on 2 Jan 2012 at 2:32
This problem has bugged me too, to the point I wrote a script to remove the
extra ()'s once.
There is actually a patch to OpenSimulator to allow it to compile this kind of
statement, I can't remember where I found it but I downloaded the osgrid
opensim source bundle, compiled it and it works fine, taking direct LSLForge
.lsl file output. Worth a hunt!
Original comment by Iain.Pri...@gmail.com
on 17 Feb 2012 at 5:59
Did anyone find an answer to this issue or the opensim patch? I've just
returned to Eclipse/LSL+ (or forge) & a bit disappointed to see this problem is
still here!
Alternatively (slightly off topic) is there another LSL IDE which supports
'modules'? I don't think the new 'community editor' does.
Original comment by kevinbuc...@googlemail.com
on 12 Apr 2012 at 4:01
still neither LSLForge nor OpenSIM xengine provide a fix - see those entries in
bugtracker
http://opensimulator.org/mantis/view.php?id=5422
http://opensimulator.org/mantis/view.php?id=5006
Original comment by sl-z...@postman.homeip.net
on 17 Feb 2014 at 7:34
It seems author of LSLPlus didn't trust LSL operator precedence because of SVC-779 and tried to fix it on LSLPlus. To do this, LSLPlus wrapped all binary or unary expressions in parentheses ordered in LSLPlus precedence. In this way, it never depend on LSL precedence bug. It was good idea for SL scripters, but I guess the author didn't think it caused another problem on OpenSIM.
There is a patch file to remove unnecessary parentheses. But it still leaves parentheses to show precedence of && and || clearly. They have same precedence in LSL(SVC-779) but you don't need to warry about it.
I hope it works well for you and let me know when you find any bugs in the patch. It's my first work on Haskell, just started learning it in this month.
How to compile it? See 'Building the Native Executable' of http://lslplus.sourceforge.net/installation.html
It says to use GHC 6.10.1 or later, but you can't compile LSLForge or LSLPlus on 6.12.*. or later. I'm using 6.10.4.
Good luck, use it on your own risk!
Original comment by pells...@gmail.com
on 26 Mar 2014 at 3:01
Attachments:
Thanks for the work and a first feedback - I probably had not enough luck...
After I finally applied the patch (there are tabs in the file and it is not an
unified one - Eclipse/eGit and TortoiseGit don't like it ;)
and got GHC 6.10.4 (sadly not the platform, as that download file seems to be
missing), I manually added the dependencies and started to build:
[...]
Loading package HaXml-1.19.7 ... linking ... done.
src\Language\Lsl\Syntax.hs:65:38:
Warning: Imported from `Data.List' but not used: `foldl''
src\Language\Lsl\Syntax.hs:69:0:
Warning: Module `Control.Monad' is imported, but nothing from it is used,
except perhaps instances visible in `Control.Monad'
To suppress this warning, use: import Control.Monad()
src\Language\Lsl\Syntax.hs:75:0:
Warning: Module `Debug.Trace' is imported, but nothing from it is used,
except perhaps instances visible in `Debug.Trace'
To suppress this warning, use: import Debug.Trace()
[29 of 57] Compiling Language.Lsl.Parse ( src\Language\Lsl\Parse.hs,
dist\build\LSLForge\LSLForge-tmp\Language\Lsl\Parse
.o )
[30 of 57] Compiling Language.Lsl.QQ ( src\Language\Lsl\QQ.hs,
dist\build\LSLForge\LSLForge-tmp\Language\Lsl\QQ.o )
[31 of 57] Compiling Language.Lsl.Render ( src\Language\Lsl\Render.hs,
dist\build\LSLForge\LSLForge-tmp\Language\Lsl\Ren
der.o )
src\Language\Lsl\Render.hs:207:5: parse error on input `='
the patched Render.hs looks like that at the above named spot:
(207 : lo = \ t -> isLower ex t || needsBooleanParens ex t)
[...]
(PostInc va) -> renderVarAccess va . renderString "++"
(PostDec va) -> renderVarAccess va . renderString "--"
(PreInc va) -> renderString "++" . renderVarAccess va
(PreDec va) -> renderString "--" . renderVarAccess va
where
lo = \ t -> isLower ex t || needsBooleanParens ex t
renderInParens f = renderChar '(' . f . renderChar ')'
renderBinExpr op expr1 expr2 f =
renderInParenIfLower expr1 f . renderChar ' ' . renderString op . renderChar ' ' .
renderInParenIfLower expr2 f
renderAssignment va op expr =
renderVarAccess va . renderChar ' ' . renderString op . renderChar ' ' . renderCtxExpr expr
renderComponent All = blank
renderComponent X = renderString ".x"
renderComponent Y = renderString ".y"
[...]
Not sure what that means, as I don't know Haskell, but maybe patching via
cygwin went wrong?
Original comment by sl-z...@postman.homeip.net
on 27 Mar 2014 at 5:52
I'm not sure but tab characters made something wrong...
Attaching new patch without tabs.
Original comment by pells...@gmail.com
on 27 Mar 2014 at 7:14
Attachments:
Thanks for the new patchfile, looks like I had messed something regarding 'tab
to spaces' - this one compiles and i was finally able to get a running
LSLForge.exe...
but already found a bug:
===lslp code snippet===
[...]
} else if (g_iOn) {
if ((~llSubStringIndex(message, "cam")) || ((string)((integer)message) == message)) {
if (g_iCamPos) {
[...]
===lsl compiled snippet===
[...]
else if (g_iOn) {
if (~llSubStringIndex(message,"cam") || (string)(integer)message == message) {
if (g_iCamPos) {
if ("cam" == message) {
[...]
another question - how do I let LSLForge add it's version to the rendered file?
I changed version number in LSLForge.hs to get a feedback on commandline, and
modified Render.hs
(renderString "// LSL script generated - patched Render.hs: " . renderString stamp . renderString "\n" .
to get
// LSL script generated - patched Render.hs: LSL.CameraScript.lslp Thu Mar 27
13:18:29 Mitteleuropäische Zeit 2014
////////////////////////////////////////////////////////////////////////////////
///////////////////
but I would prefer having some kind of version number after timestamp
Original comment by sl-z...@postman.homeip.net
on 27 Mar 2014 at 12:23
Thank you for pointing out the bug. I missed it, cast of cast. Here's the patch.
About version stamp, it will cause circular dependency when import Main from Render. Let me think it carefully, I don't want to add new .hs files yet...
Original comment by pells...@gmail.com
on 27 Mar 2014 at 11:32
Attachments:
Havn't seen problems yet. Thank You!
Ahh, did not think about how to import and get hold of that variable -
and nevermind, there could be done other things that are more interesting and
valuable like testing if with Mono variables like 'TRUE' one really needs
replacement, better checking of 'if (a && b)' statements for their result etc.
...
Not to forget that this issue list holds some things too. Maybe I should learn
Haskell too, but Eclipse+Haskell plugin is giving me so much grief.
Hope I have time after the weekend to run one of my scripts with TRUE/FALSE and
1/0 and compare memory usage
Original comment by sl-z...@postman.homeip.net
on 28 Mar 2014 at 11:50
Thank you for testing the patch! I'm glad that it works well:)
There are so many things to learn modifying LSLForge. I just started it, but I can say that Haskell is not so hard, try to lean it, easier than Eclipse Plugin framework, lol.
I want to provide dependency checking at compile time. Without it, all .lslp scripts in workspace are compiled at start up of Eclipse and time stamp of .lsl files are updated without any source modifications. I don't like it.
I found the way to fix parentheses problem on the way to learn how LSLForge compiler works.
I've thought to fix time stamp problem since I'd been using LSLPlus. I'm not sure when I can do it, but may found ways to fix other issues.
Try to lean Haskell, it is a very interesting language.
Original comment by pells...@gmail.com
on 29 Mar 2014 at 6:54
Original issue reported on code.google.com by
mike.ch...@alternatemetaverse.com
on 26 Oct 2011 at 11:40