Commit graph

4 commits

Author SHA1 Message Date
Kevin Eady
593cfffb83
Add uninit, true, false keywords to grammar (#596)
* Update grammar

* Update expression handling for uninit

* update existing tests

* Add new tests

* Remove fullpath from escriptgrammar generation comment

* fix tests

* Update eScript guide

* Declare escript version 0x11

* Add core-changes

* Add `true` and `false` to grammar

* true/false implementation

* Fix existing tests

* Add new tests

* Update core changes

* add docs

* Fix BooleanValue::describe_to

* bool optimizations

* optimize uninit

* remove unused var assignments

* Update grammar for case labels for uninit, booleans

* Fix case label handling for uninit, true, false

* Tests

* Fix compiler version display v1.1700000017881393 -> v1.17

* optimize boolean binary operations

* fix unary boolean optimizer

* add boolean, uninit optimizer test

* Use new fmt lib apis

* Fix compiler warning

* really fix warning lol

* Add Executor[Module]::getParam for bools, FindSubstance test
2024-01-20 05:38:25 +01:00
Eric Swanson
cc1b0c6ee3 fix optimizer bug: can stop optimizing prematurely if pre- or post-decrement operators are present
optimize_token() is meant to return true only if it performs an optimization.

By returning true when it did not, it makes the optimizer stop trying.

A script like this can trigger the condition:

var i := 3;
var ii;

ii := 1 - (--i);
print(i);
print(ii);

Notice that line 4 does not optimize to an 'assign-consume' and therefore does not optimize to 'assign global`

Listfile before (see instructions 6-12):

/vagrant/testsuite/escript/opt/opt005-stopped-optimizing-early.src, Line 1
var i := 3;
0: decl global #0
1: 3L
2: :=
3: #
var ii;
4: decl global #1
5: #
ii := 1 - (--i);
6: global #1
7: 1L
8: global #0
9: unary --
10: -
11: :=
12: #
print(i);
13: global #0
14: Func(1,0): Print
15: #
print(ii);
16: global #1
17: Func(1,0): Print
18: #
19: progend

Listfile after (see instructions 6-10):

/vagrant/testsuite/escript/opt/opt005-stopped-optimizing-early.src, Line 1
var i := 3;
0: decl global #0
1: 3L
2: :=
3: #
var ii;
4: decl global #1
5: #
ii := 1 - (--i);
6: 1L
7: global #0
8: unary --
9: -
10: global1 :=
print(i);
11: global #0
12: Func(1,0): Print
13: #
print(ii);
14: global #1
15: Func(1,0): Print
16: #
17: progend
2020-07-29 20:42:07 -07:00
turleypol
e6f59a69a9 removed instructions testscript files they are not used
removed appveyor xml testresult (I'm to dumb)
2018-10-31 12:09:31 +01:00
Gabriele Tozzi
0efeb4d379 Unit Tests: putting some orde rin escript unit tests 2015-12-19 02:31:08 +01:00