Strc hides the output of the C compiler if there is no error, which is a bit of a problem, since the C compiler is currently the only way in which an incorrect order of strategy arguments is reported.

Example:
————————————–
module foo
imports list-cons
strategies

main =
foo(ho(![]))

strategies

foo(arg: (t -> t) * t -> t) =
arg(![])

strategies

ho(s) =
s
————————————–


martin@linux:~> strc -i foo.str
[ strc | info ] Compiling ‘foo.str’
[ strc | info ] Front-end succeeded : [user/system] = [0.41s/0.92s]
[ strc | info ] Optimization succeeded -O 2 : [user/system] = [0.01s/0.10s]
[ strc | info ] Back-end succeeded : [user/system] = [0.19s/0.23s]
[ strc | info ] C compilation succeeded : [user/system] = [0.30s/0.14s]
[ strc | info ] Compilation succeeded : [user/system] = [0.91s/1.39s]
martin@linux:~>
————————————–

Only at verbosity level 2, the output of the C compiler is reported:
————————————–
[ strc | notice ] Compiling C code
[ strc | notice ] Command: gcc -I /pkg/strategoxt/2005-12-12-16-32/include -I /pkg/strategoxt/2005-12-12-16-32/include -I /home/martin/.nix-profile/include -c foo.c -o foo.o
foo.c: In function main_0_0': foo.c:23: warning: passing arg 1 offoo_1_0’ from incompatible pointer type
[ strc | notice ] Linking object code
————————————–

Possible solutions:
* pass -Werror the C compiler
* implement a type-checker for the order of strategies in Stratego (and base the renaming on information produced by this type checker)

Submitted on 1 January 2006 at 13:16

On 2 March 2006 at 22:58 Jira commented:

STR-498, karltk:
The following code is valid:


main = l3(l2)

l0 = !5

l1(s0 : a -> a) = s0

l2(s1 : (a -> a) * a -> a) = s1(l0)

l3(s2 : ((a -> a) * a -> a) * a -> a) = s2(l1)
—-

Replacing the last def with:

l3(s2 : ((a -> a) * a -> a) * a -> a) = s2(l1(!6))

should fail to compiler. Even if it succeeded, it should still give the result 5, but the standalone compiler will swallow this code silently, and erroneously result in the term 6.


On 19 December 2006 at 20:58 Jira commented:

STR-498, martin:
This issue is critical for 0.17, since errors in the order of arguments are no longer reported by the C compiler due to the changes in the compilation scheme.


On 19 December 2006 at 21:03 Jira commented:

STR-498, martin:
The stand-alone compiler no longer hides the output of the C compiler. Also, the C compiler does not warn about the order anymore. These order issues should be fixed in STR-497.

Log in to post comments