Commit graph

643 commits

Author SHA1 Message Date
Sei Lisa
64e5d0dc92 Check that it's a variable definition before collapsing or giving warning. 2014-07-27 22:04:15 +02:00
Sei Lisa
100de9c8e9 Fix output of lists < 5 elements 2014-07-27 21:23:57 +02:00
Sei Lisa
3dd73f218f Fix a few more statements missing. 2014-07-27 21:05:57 +02:00
Sei Lisa
dde3c08f61 Add TODO item: skip preprocessor directives. 2014-07-27 21:05:01 +02:00
Sei Lisa
0f55129f71 Add important comment 2014-07-27 21:04:31 +02:00
Sei Lisa
6af4f40752 Add TODO items 2014-07-27 20:48:37 +02:00
Sei Lisa
1747028211 Finish coverage tests. 2014-07-27 20:26:24 +02:00
Sei Lisa
7623c444a8 Forgot empty statement. Also make warning more prominent. 2014-07-27 20:14:25 +02:00
Sei Lisa
e57c21a73a Fix FIELD and IDENT in globals. 2014-07-27 20:03:57 +02:00
Sei Lisa
30efb5d14c Bug fix: look up library functions too! 2014-07-27 19:18:05 +02:00
Sei Lisa
f3339b0906 Fix an infinite recursion by disallowing forward globals in global var defs. 2014-07-27 18:42:55 +02:00
Sei Lisa
c483d5ea71 Bunch of bug fixes. 2014-07-27 18:07:35 +02:00
Sei Lisa
f1656c41aa Import 'warning' from lslparse instead of redefining. Cosmetic fixes. 2014-07-27 18:05:11 +02:00
Sei Lisa
26ab4f0382 Fix class definitions to make sense (le-sigh - python quirk) 2014-07-27 17:40:26 +02:00
Sei Lisa
124a2823a0 builtins.txt was not named as the source of some errors. Fixed. 2014-07-27 13:49:18 +02:00
Sei Lisa
609df368f3 Fix a case with list mode for globals. 2014-07-27 13:47:18 +02:00
Sei Lisa
beb413420d Disable the debug code 2014-07-27 13:44:13 +02:00
Sei Lisa
0b74093255 Fix tuple mess, typecast bug, and boolean bug.
Fix the tuple mess with the right approach. The EXPR tuple should not be changed, only the content.

Fix bug with typecasts. (NOTE: Debug code active)

Fix bug where <= and >= were returning bool instead of int.
2014-07-27 13:43:16 +02:00
Sei Lisa
d856f62253 Fix optsigns treatment. 2014-07-27 04:31:45 +02:00
Sei Lisa
6e1357f4f3 Handle type cast optimization in the output module (easiest). 2014-07-27 04:24:14 +02:00
Sei Lisa
d98e145090 Add missing operators & returns, remove typecast bogus optimization. 2014-07-27 04:15:12 +02:00
Sei Lisa
33440f5dd4 Fold vector/rotation/list expressions into constants. 2014-07-27 03:17:38 +02:00
Sei Lisa
4f7933aa3b Remove "drunk" comment. 2014-07-27 02:56:35 +02:00
Sei Lisa
b76ae99616 Fixes and folding improvements to the FOR loop.
Added an utility function to fold a list of expressions and completely remove the unused members. No known use besides FOR.
2014-07-27 02:52:16 +02:00
Sei Lisa
59de1e1f4f First prototype version of the optimizer. 2014-07-27 02:19:54 +02:00
Sei Lisa
603b85afc8 Remove hack and output expressions where expected. 2014-07-27 02:18:37 +02:00
Sei Lisa
cef3e626a9 Associate identifiers with their direct location.
Instead of returning the scope level at which search can start, return the scope level at which the symbol actually is.
2014-07-27 01:49:44 +02:00
Sei Lisa
12a1245102 Add ';' to the interning string table. 2014-07-27 01:28:35 +02:00
Sei Lisa
ecaa4b1af0 Output negative integers as hex. 2014-07-27 01:27:37 +02:00
Sei Lisa
e2918e7f05 Add constant NULL_KEY and function cond(). 2014-07-26 23:50:49 +02:00
Sei Lisa
a3354fae0e First steps in optimizer.
Still WIP, though, but it already optimizes e.g. this:

default { timer() { 2+2; } }

to this:

default { timer() { 4; } }
2014-07-26 21:32:01 +02:00
Sei Lisa
e8e411ad04 Fix thread safety of llList2CSV. 2014-07-26 21:25:06 +02:00
Sei Lisa
a3de885bf7 Move the functions that were scheduled to be moved. 2014-07-26 21:06:53 +02:00
Sei Lisa
4bff3aaf94 Thorough review of lslbasefuncs and associated files, adding new stuff.
- Scratch TODO item: Change shouldbeXXX to asserts.
  - shoudlbeXXX(x) has been turned into assert isXXX(x). Affects lsl2json too.

- New base functions:
  - compare (for == and !=)
  - less (for <, >, <=, >=)

- minus() renamed to neg() for consistency. Affects testfuncs too.

- add() now supports key+string and string+key.

- Allow integers in place of floats. That has caused the addition of three utility functions:
  - ff (force float)
  - v2f (force floats in all components of a vector)
  - q2f (force floats in all components of a quaternion)
  Used everywhere where necessary.

  Special care was taken in a few funcs (llListFindList and maybe others) to ensure that lists containing vectors or quaternions which in turn contain integer components, behave as if they were floats, because LSL lists can not physically hold integer values as components of vectors/quats.
  This also fixes a case where if a large integer had more precision than a F32 (e.g. 16777217), the product/division would be more precise than what LSL returns.

- Fix bugs of missing F32() in some places (llRotBetween, llEuler2Rot).

- Some functions marked for moving in an incoming commit.

- llList2CSV marked with a warning that it is not thread safe. That's a future TODO.

- Document llListFindList better.

- Make llListStatistics Use a more orthodox method to return the result for LIST_STAT_RANGE, LIST_STAT_MIN, LIST_STAT_MAX.

- Make llAxisAngle2Rot use more precision from llVecNorm, by adding an optional truncation parameter in the latter.

- Change order of some F32(Quaternion(...)) to not force so much instancing.

- Bugfix: llVecNorm did not return a Vector.
2014-07-26 20:54:01 +02:00
Sei Lisa
de4a8d4dac Add the Firestorm features as TODO tasks. 2014-07-26 04:57:58 +02:00
Sei Lisa
8078be8401 Cosmetic: make another comment clearer 2014-07-26 04:45:56 +02:00
Sei Lisa
cfa7e1de89 Cosmetic: make a comment clearer 2014-07-26 04:44:02 +02:00
Sei Lisa
e03b342f78 Allow concatenation of key+string and string+key producing string.
Also add corresponding test cases, making some mostly cosmetic changes to the test program while on it.
2014-07-26 04:41:09 +02:00
Sei Lisa
841413a2cf Remove bogus FIXME comment. 2014-07-26 04:35:57 +02:00
Sei Lisa
0b49a9590f Delete options when no longer necessary. 2014-07-26 04:01:12 +02:00
Sei Lisa
b36356db45 Change default options set to frozenset, and add a TODO.
Not convinced a set is the way to go here, though, given it's checked at the beginning only.
2014-07-26 03:59:35 +02:00
Sei Lisa
a46c5463eb Add 'allowmultistrings' option.
This option enables a C-style feature where strings can be composed by juxtaposing them, like this: "blah" "another" in the input program becomes "blahanother" in the output.
2014-07-26 03:44:48 +02:00
Sei Lisa
05d00e075b Initial commit. Status so far:
- Parser and output modules are thoroughly tested and working.
- Most LSL immutable functions are working; some not tested; llJsonSetValue not implemented.
- Parser recognizes the following flags that alter syntax:
   extendedglobalexpr: Allow full expression syntax in globals.
   extendedtypecast: Allow full unary expressions in typecasts e.g. (float)~i.
   extendedassignment: Enable the C assignment operators &=, ^=, |=, <<=, >>=.
   explicitcast: Add explicit casts wherever they are done implicitly, e.g. float f=3; -> float f=(float)3;.
  Of them, only extendedglobalexpr is useless so far, as it requires the optimizer to be working.
2014-07-26 02:43:44 +02:00