Commit graph

876 commits

Author SHA1 Message Date
Sei Lisa
5b105e5772 Some enhancements to README.md 2015-03-14 11:33:43 +01:00
Sei Lisa
aa0d84e01b Another link fix *sigh* 2015-03-14 04:11:11 +01:00
Sei Lisa
a462b6b41d Fix link. 2015-03-14 04:10:11 +01:00
Sei Lisa
a947b63730 README.md: Move documentation to seis.shop.tm 2015-03-14 03:53:44 +01:00
Sei Lisa
9bd66dd6fa Optimize out function calls to SEF functions with non-SEF arguments.
The function call is removed, and the arguments transformed to a block of expression statements.
2015-03-13 23:48:24 +01:00
Sei Lisa
df31a69465 In functions that end in 'return;', remove the 'return;'.
This allows better side-effect analysis, because 'return' is not side-effect free unless it's the last statement. But that's better handled in the dead code removal module, as the comment specifies.
2015-03-13 23:46:23 +01:00
Sei Lisa
9cb02839bc Remove extra code. 2015-03-13 23:45:56 +01:00
Sei Lisa
f6b472133a Optimize [elem] -> (list)elem on output. Saves us headaches. 2015-03-13 22:42:00 +01:00
Sei Lisa
2948399bf8 Revert 3b7e461d82, as it introduced bugs. 2015-03-13 22:13:00 +01:00
Sei Lisa
f7556e7a66 Remove globals from symbol table when no longer necessary. 2015-03-13 20:11:57 +01:00
Sei Lisa
5ca8e3db3f Expand README.md with optimization explanations and an intro to the features. 2015-03-13 19:01:13 +01:00
Sei Lisa
2e2975ef95 Fix unit tests. 2015-03-13 16:56:32 +01:00
Sei Lisa
fc7abc7d99 Fix bug broken by 562154e7aa.
Referencing a global that was optimized out, caused a crash.

```
integer DEBUG = 1;

default
{
    state_entry()
    {
        if (DEBUG) llOwnerSay("DEBUG");
    }
}
```
2015-03-13 16:49:31 +01:00
Sei Lisa
3d965f13e0 Fix bug with the scope of function calls.
Makes this script work, as it should:

`default { timer() { string llSay; llSay(0, llSay); } }`
2015-03-13 16:43:35 +01:00
Sei Lisa
890e960b57 Implement Lazy List reading. Update docs according to last changes (in FS too).
Adds a new tree node type, SUBIDX, which hopefully should never appear in actual output. If it does, it's prefixed with the string (MISSING TYPE) as a cue to the programmer.
2015-03-13 06:38:35 +01:00
Sei Lisa
535dc8434c Allow a code block instead of a ':' as terminator for 'case' and 'default'.
For Firestorm compatibility.
2015-03-13 05:16:22 +01:00
Sei Lisa
39b6036671 Remove 'Scope' from functions in symbol table. Function scope is always 0. 2015-03-13 05:12:09 +01:00
Sei Lisa
4f8d2979aa Fix typo in EParseFunctionMismatch. 2015-03-13 03:28:51 +01:00
Sei Lisa
4065fa95bb FS's optimizer now sucks a bit less thanks to the author's contributions. 2015-03-11 06:10:41 +01:00
Sei Lisa
63e3021a6d Comment tweaking. 2015-03-09 13:20:37 +01:00
Sei Lisa
9c926b6fec Fix obsolete comment.
There was a time where I decided that the tree would be stored inside the symbol table, as values for the global symbols. I changed my mind later and separated them, but that comment remained.
2015-03-09 01:07:55 +01:00
Sei Lisa
6a0eebf157 Implement a couple subtleties of the lexer in the handling of strings.
First, a string does not have its own context, it's a regular expression, therefore if there isn't a matching closing quote until EOF, it's not an unterminated string. It plainly *isn't* a string.

Second, the string lexer searches for either the regexp '[^"\\]' (any character except a double quote or a backslash) or the regexp '\\.', that is, a backslash followed by an "any character" meta. But the "any character" meta does NOT match a newline. The consequence is that a '\' followed by a newline cancels the matching, and the whole thing is not considered a string.

Isolated double quotes are then plain ignored as many other characters.

An example illustrating both cases:
```
default
{
    state_entry()
    {
        string msg = "Hello, Avatar!";
        llOwnerSay"(msg); // the opening quote will be ignored
        // the following backslash at EOL cancels the previous double quote: \
        llOwnerSay(llGetKey(")); // Unterminated string; unmatched so ignored.
    }
}
```
2015-03-08 16:53:58 +01:00
Sei Lisa
defa9fde97 Typo in help 2015-03-07 22:55:25 +01:00
Sei Lisa
1e8b77bf50 Rather than generating random identifiers for locals, prefix them with 'loc_'.
Should help improving readability of the optimized script.
2015-03-07 14:51:51 +01:00
Sei Lisa
a292846d28 Fix missing scope table index when generating the call to lazy_list_set. 2015-03-07 14:50:25 +01:00
Sei Lisa
562154e7aa Remove the symbol table entry too when removing a global state/function/var. 2015-03-07 14:33:11 +01:00
Sei Lisa
b112494311 Support for other IDEs 2015-03-07 13:52:44 +01:00
Sei Lisa
2b56d06e60 Comment on lack of location info of warnings. 2015-03-07 13:41:20 +01:00
Sei Lisa
59cdd64228 Warn about float constants that can't be represented in globals. Also don't duplicate the globals warnings. 2015-03-06 23:26:58 +01:00
Sei Lisa
c1d837674c Forgot to exclude globals from this optimization somehow. 2015-03-06 22:55:28 +01:00
Sei Lisa
7c35cf64df Mention OS X command to pipe to clipboard. 2015-03-06 20:35:05 +01:00
Sei Lisa
a9179f2779 Read the data files from the same path where the script resides. 2015-03-06 20:29:54 +01:00
Sei Lisa
ac9f0c30a5 More tweaks to README.md 2015-03-06 20:26:44 +01:00
Sei Lisa
109d2b4324 README.md tweaks++ 2015-03-06 19:03:03 +01:00
Sei Lisa
e9d8af6e11 llGetKey example replaced with llGetOwner. 2015-03-06 03:44:21 +01:00
Sei Lisa
9e9997bc98 More README.md tweaks 2015-03-06 03:42:11 +01:00
Sei Lisa
7cedd7e157 Improvements to README.md 2015-03-06 03:22:06 +01:00
Sei Lisa
a304cf989c Add README.md 2015-03-06 02:58:29 +01:00
Sei Lisa
50c2787ef4 Reorder the help lines to make better sense. 2015-03-06 02:56:58 +01:00
Sei Lisa
ed17d3330d Updated builtins.txt and builtins.txt.dat 2015-03-05 23:37:43 +01:00
Sei Lisa
c68a1f4ad6 Add copyright notices to all files, to prepare the program for release. 2015-03-05 23:18:41 +01:00
Sei Lisa
d164b0fa44 Tweak the main help text. 2015-03-05 20:45:38 +01:00
Sei Lisa
33de6c0efc Comment typo, brackets->braces. 2015-03-05 20:18:13 +01:00
Sei Lisa
308ca7c8ff Add support for 'break n;' and 'continue n;'. Also simplify the break/continue stacks handling code and fix some bugs. 2015-03-05 20:12:32 +01:00
Sei Lisa
d4035b0723 Add incompatibility note on JSON. 2015-03-05 18:48:28 +01:00
Sei Lisa
e5cb37dfe4 For now, enable the RE 2015-03-05 14:42:02 +01:00
Sei Lisa
f730843762 More TODO tweaking. 2015-03-05 06:20:11 +01:00
Sei Lisa
7fb345b222 'case' needed to be in the list of 4-char words to avoid. Also tweak a comment. 2015-03-05 06:18:53 +01:00
Sei Lisa
cbcf60767a Implement break/continue and switch().
While on it, reorganize the help text and enable 'dcr' by default.
2015-03-05 01:37:32 +01:00
Sei Lisa
a36715f121 Add reference source, comments. 2015-03-04 02:01:03 +01:00