[Opensim-dev] My new LSL compiler project

Eric <redacted> at gmail.com
Mon Nov 2 19:24:36 UTC 2015


Hello all.

I am a bit new to OpenSim development (well at-least sharing stuff I have
made..) but for a quite a while now I have been working on
a new (BSD Licensed) Compilation/Code Generation framework for LSL,
tailored towards usage with OpenSim.  I thought I should share it
at this point of its development.


This is pretty much a "full" or "true" compiler front end.

It's built on-top of ANTLR4 and ANTLR4's CSharp target.
ANTLR4 however has been completely abstracted and the library provides its
own Rich LSL Syntax Tree for users to deal with.

My library includes an OpenSim code generation target which I have
integrated into my OpenSim fork on GitHub, it's implemented as an
optional compiler that you can enable in your OpenSim.ini.


The Code validation step my library performs when building a syntax tree
implements full front end syntax checking, dead code detection, the works.
It also emits extended warning information that is standard to most
compilers now days.


The OpenSim code generator I have written and included with the library
drastically improves compatibility with scripts written for SecondLife.
Order of evaluation in generated code is correct for LSL (Right to Left)
among many other things.

As an example, all of the encryption scripts you can find on the LSL wiki
will compile correctly and execute with correct behavior using my compiler.


The README.md for the project goes into a bit more detail on what all the
library can do.


My library LibLSLCC is on GitHub here:

https://github.com/EriHoss/LibLSLCC


The project includes an LSL Editor (Windows Only, I used AvalonEdit) with
the project that features code completion and syntax highlighting.

It can be used to test CSharp code generation for OpenSim by compiling LSL
into C# using LibLSLCC, which can then be uploaded to an
OpenSim server with C# scripting enabled.

The library itself is cross-platform, but the editor and editor installer
are not.  There's a separate project file for building the library on
mono with monodevelop/xbuild.


===


The OpenSim fork that integrates my compiler is here:

https://github.com/EriHoss/OpenSim_With_LibLSLCC


It includes a few minor bug fixes to XEngine and Runtime Script functions.

Such as the 'IdleTimeout' setting not being honored properly.

And llParseString2List using culture specific comparisons, causing it to
misbehave when comparing Unicode characters on Mono.



I have added new attributes to OpenSim's script module constants/functions
and also to ScriptBaseClass.
This is so LibLSLCC can de-serialize the classes into library data that's
consumable by its code validator and code generator.

I have also made some slight changes to IScriptModuleComms and
ScriptModuleCommsModule.

The old compiler in my fork works as it did before, so you can switch back
and forth from LibLSLCC to the old compiler
if you want without any problems.

There are more details on the changes I have made in the README.md.


==

I started working on this sometime early last year when I broke my wrist
and was unable to do much for a while, and
I have only recently moved the code from my Git server up to GitHub.  I'm
going to continue improving this in my spare time,
right now I am doing rolling releases versioned by date anywhere from once
every few days to a few times a day.  I am also keeping my OpenSim fork
synced with the latest OpenSim commits.

Hopefully this will be useful, any feedback is appreciated :)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://opensimulator.org/pipermail/opensim-dev/attachments/20151102/9951c734/attachment.html>


More information about the Opensim-dev mailing list