saladdais / lummao Goto Github PK
View Code? Open in Web Editor NEWToolkit for compiling and executing the Linden Scripting Language as Python.
License: GNU General Public License v3.0
Toolkit for compiling and executing the Linden Scripting Language as Python.
License: GNU General Public License v3.0
From https://docs.python.org/3.11/whatsnew/3.11.html#cpython-bytecode-changes:
Replaced JUMP_IF_NOT_EXC_MATCH by CHECK_EXC_MATCH which performs the check but does not jump.
Replaced JUMP_IF_NOT_EG_MATCH by CHECK_EG_MATCH which performs the check but does not jump.
Replaced JUMP_ABSOLUTE by the relative JUMP_BACKWARD.
Added JUMP_BACKWARD_NO_INTERRUPT, which is used in certain loops where it is undesirable to handle interrupts.
Replaced POP_JUMP_IF_TRUE and POP_JUMP_IF_FALSE by the relative POP_JUMP_FORWARD_IF_TRUE, POP_JUMP_BACKWARD_IF_TRUE, POP_JUMP_FORWARD_IF_FALSE and POP_JUMP_BACKWARD_IF_FALSE.
Added POP_JUMP_FORWARD_IF_NOT_NONE, POP_JUMP_BACKWARD_IF_NOT_NONE, POP_JUMP_FORWARD_IF_NONE and POP_JUMP_BACKWARD_IF_NONE opcodes to speed up conditional jumps.
Looks like the most important change is that absolute jumps no longer exist, and we have to use separate forward
/ backward
relative jump types now. Will need separate codegen paths for 3.11+.
We need to do symbol name mangling to enforce LSL's shadowing rules, as well as prevent people from shadowing Python or Lummao builtins from their scripts.
Probably further down the road, since I'd have to figure out how to rewrite the desugaring logic for PyOptimizer as well, but it'd be nice to get rid of the native code if we don't really need it.
Not many sane scripts actually do this, but required for things like
jump foo;
integer bar = 1;
@foo;
llOwnerSay((string)bar); // should print "0"
to work "correctly". Heap types should be declared with Optional[...]
wrapper around their type and a default value of None
, and hoisted declarations for quaternions should be <0, 0, 0, 0>
rather than ZERO_ROTATION
.
Depends on #1 . It was mentioned that the cibuildwheel Github action may be helpful for doing the cross-compiling as well.
Lummao is annoying to set up right now, and an action would be helpful since some people are going to want to test their LSL scripts in CI.
Would be great to be able to do script_cls = exec(lummao.lsl_to_python(lsl_text)).Script
or something like that to dynamically convert LSL to Python at runtime. Then we could just build binary wheels that include everything people need instead of needing to do compile a bunch of stuff and run CLI commands separately.
Depends on SaladDais/tailslide#24.
We use LSL-PyOptimizer's typecast function for runtime casts, but it's failing on a couple of cases from the second LSL language conformance test:
>>> lslopt.lslfuncs.typecast(lslopt.lslfuncs.F32(1.4e-45), str)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/user/source/LSL-PyOptimizer/lslopt/lslbasefuncs.py", line 649, in typecast
return InternalTypecast(val, out, InList, f32)
File "/home/user/source/LSL-PyOptimizer/lslopt/lslbasefuncs.py", line 470, in InternalTypecast
if out == unicode: return f2s(val, 6)
File "/home/user/source/LSL-PyOptimizer/lslopt/lslbasefuncs.py", line 391, in f2s
while s[i] in u'0.':
IndexError: string index out of range
because it gets formatted as 0.00000
internally, but its float val is not equal to 0.0
, making that loop explode.
also:
>>> lslopt.lslfuncs.typecast("-0.0", float)
0.0
when it should be -0.0
seems to be due to a missing math.copysign()
call when replacing things equivalent to 0.0 with 0.0 itself.
LSL-PyOptimizer itself doesn't run into either of these issues when optimizing an LSL script. Need to dig in more, things might be special-cased further up in the folding code.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.