Commit graph

877 commits

Author SHA1 Message Date
Sei Lisa
a36715f121 Add reference source, comments. 2015-03-04 02:01:03 +01:00
Sei Lisa
8b9676e5dc Fix missing 'paramscope', remove commented out old body, simplify. 2015-03-04 01:51:08 +01:00
Sei Lisa
a6127cf144 lazylistcompat idea ditched. 2015-03-04 00:40:07 +01:00
Sei Lisa
87b6002b6c Fix the bug detected in llListReplaceList. 2015-03-04 00:31:55 +01:00
Sei Lisa
8ea6ae50fd Replace the lazy_list_set function with a more compact one. 2015-03-03 20:00:40 +01:00
Sei Lisa
30c492d2b3 Oops, fix a format string fail (the help wasn't shown). 2015-03-03 19:58:40 +01:00
Sei Lisa
b73805e0ce Add "lazy lists" assignment support (mylist[index] = value).
Add support for LAMBDA (empty) tree nodes while on it, that allow us to define private stuff at the top without caring about Loc.
2015-03-03 17:59:51 +01:00
Sei Lisa
7e521780d6 Two more optimizations TODO 2015-03-03 17:49:57 +01:00
Sei Lisa
e36fc83b39 Noted important bug in llListReplaceList 2015-03-03 17:26:50 +01:00
Sei Lisa
0b55f6e64d Oops, the operator is !, not - 2015-03-03 02:20:31 +01:00
Sei Lisa
05d46e9ac3 Optimize comparisons of the form int>2147483647 or int<-2147483648 and expand (>=, <=, !=) to !(<, >, ==) respectively. 2015-03-03 02:16:00 +01:00
Sei Lisa
493aed6c39 Optimize (-a)*b or a*(-b) to -(a*b), revisiting the expression.
This obviates the need for (-a)*(-b) because it will be simplified automatically. It also enables (a+1)*b-1 to be simplified to just ~(~a*b). Still missing simplifying a*b+b to (a+1)*b, but that's more complicated.
2015-03-03 01:46:53 +01:00
Sei Lisa
22a1a2e8ba Document the change to the symtab structure. 2015-03-03 00:51:48 +01:00
Sei Lisa
01f2bba2f4 Make *-2 and *2 only work for local variables. Needed an adition to the parser. 2015-03-03 00:49:14 +01:00
Sei Lisa
d8f42a5071 Remove obsolete comment about parentheses (they are now implicit). 2015-03-03 00:47:15 +01:00
Sei Lisa
c650ad26f8 Comment changes only. 2015-03-02 23:28:14 +01:00
Sei Lisa
3b7e461d82 Convert [x] -> (list)x except in globals. 2015-02-28 22:48:11 +01:00
Sei Lisa
831296eddc Minor shortening of name to fit in line 2015-02-28 21:46:19 +01:00
Sei Lisa
762bf1f27b Add some FIXMEs and TODOs, remove comment that no longer makes sense. 2015-02-28 20:39:23 +01:00
Sei Lisa
0ca5a8f5b0 Fix typo that made function calls be wrapped in parentheses on output.
No biggie, but what's right is right.
2015-02-28 20:37:59 +01:00
Sei Lisa
e30a4ea25d Fix addstrings option (oops). 2015-02-28 20:37:18 +01:00
Sei Lisa
8f83e2f1ab Add "addstrings" option (disabled by default) to select whether to automatically concatenate strings during constant folding. 2015-02-28 20:01:51 +01:00
Sei Lisa
6ea01c4242 Added optimizations for most operators, and 'cornermath' option.
Only remaining operators are < <= > >= &.
2015-02-28 18:30:04 +01:00
Sei Lisa
1440f7811e Fix bug where (float)"infi" did not produce Infinity. 2015-02-28 17:34:26 +01:00
Sei Lisa
42ac090f03 Big bunch of expressions optimized, boolean/bitwise, and some new ideas.
a != -1 is now optimized to ~a in conditions. a == 1, a != 1, etc. are all optimized. a||b -> a|b is done. a^0, a^-1 are optimized. a&&b is transformed to !(!a|!b), but not yet into a&b when possible.
2015-02-28 05:14:52 +01:00
Sei Lisa
1dea1bd12c Make parentheses no longer explicit in the AST (Beta).
The output module adds parentheses where necessary, depending on the evaluation order in the tree. Or that's the idea. Prone to bugs, let's see how it bodes.
2015-02-28 00:43:26 +01:00
Sei Lisa
59451b90e5 On second thought, parentheses are only needed for ~ because it binds tighter. 2015-02-27 20:12:17 +01:00
Sei Lisa
25cbb91b6e Fix bug where n*3+1 was optimized as -~n*3 rather than as -~(n*3). Also merge -2 with -1 and +2 with +1. 2015-02-27 20:05:14 +01:00
Sei Lisa
2047a128fb Add two TODO items about parameters to common functions. 2015-02-27 19:20:31 +01:00
Sei Lisa
536b1ed2f9 Fix comments that mentioned the wrong property. 2015-02-27 19:18:28 +01:00
Sei Lisa
07590ea850 Fix bug where (a * 5) + 4 was converted to a + 5 + 4. 2015-02-27 19:12:22 +01:00
Sei Lisa
4c08b7173a minor clarification of comment 2015-02-27 04:46:23 +01:00
Sei Lisa
d2fb302684 Add more functions whose result is known for certain operands. 2015-02-12 07:49:32 +01:00
Sei Lisa
6fb947fbc9 (Limitedly) apply distributive law for string and integer addition. 2015-02-12 07:47:35 +01:00
Sei Lisa
4461f36dce Emergency fix for a bug discovered via a nPose plugin. 2015-02-12 07:46:02 +01:00
Sei Lisa
0a0e5926d5 Fix bug where negative signs of global integers weren't being output. 2015-02-12 04:23:47 +01:00
Sei Lisa
b62fb9a808 Make isstring and iskey stricter, plus one cosmetic change 2015-02-11 18:17:01 +01:00
Sei Lisa
86ca90a65b Remove obsolete comment 2015-02-11 17:12:35 +01:00
Sei Lisa
db862bb4a6 Multi-commit:
- Fix a bunch of bugs found during the debut of the LSL calculator.
- Add infrastructure for functions to be able to produce a result or not depending on arguments. Fixes the llBase64ToInteger/llXorBase64/llXorBase64StringsCorrect cases where they are not deterministic, and allows for the addition of some extra functions whose value can be determined in some cases (e.g. llDetectedType(-1) is always 0). Added several such functions in a new module.
- Add the constant folding option to the help and the default options.
2015-02-11 05:43:13 +01:00
Sei Lisa
716be215f2 Fix double negation and constant nodes; add optimization of -~-~ chains. Fix a case of addition. Add a case of parentheses.
(Changes were pending since Aug 19)
2014-12-13 14:16:28 +01:00
Sei Lisa
e89869a563 Add TODOs 2014-12-13 13:12:02 +01:00
Sei Lisa
c2a30fb9ee Simplify const + nonconst + const and nonconst + const + const. 2014-08-19 19:45:47 +02:00
Sei Lisa
c2437b33e7 Optimize [] + nonlist as (list)nonlist.
And minor comment changes.
2014-08-17 16:31:46 +02:00
Sei Lisa
2e87d6df8c llModPow has a delay so exclude it from SEF table. 2014-08-17 16:03:20 +02:00
Sei Lisa
f3bd091a6d Update Side-Effect Free table with latest additions. 2014-08-17 15:43:41 +02:00
Sei Lisa
8e5166bb2e Move the constant folding code to lslfoldconst.py.
lsloptimizer remains as the "conductor" and option handler.

As a result, new options have been added to enable DCR and constant folding.
2014-08-13 14:19:58 +02:00
Sei Lisa
beea757a0a Fork (add a copy of) lsloptimizer.py as lslfoldconst.py.
This commit is just a copy, to hopefully help git track it. The changes come in the next commit.
2014-08-13 14:02:05 +02:00
Sei Lisa
36759cacba Move PythonType2LSL to the main lsloptimizer script.
This is preparation work for splitting the optimizer.
2014-08-13 13:44:54 +02:00
Sei Lisa
f3301b07c6 Fix test case. 2014-08-13 13:35:19 +02:00
Sei Lisa
ed4b963356 Rename _ops to _toks to eliminate ambiguity and facilitate a future merge. 2014-08-13 13:34:09 +02:00