"SIGOURE" == SIGOURE Benoit sigoure.benoit@lrde.epita.fr writes:
Index: tests/xrm/static-const-arrays-desugar.xpm --- tests/xrm/static-const-arrays-desugar.xpm (revision 0) +++ tests/xrm/static-const-arrays-desugar.xpm (revision 0) @@ -0,0 +1,26 @@ +const int N = 3; +const int array[N] = 42;
+module test
- x[N] : [0..N] init array[N];
- [] x[array[N]]=0 -> (x[array[N]]'=1);
+endmodule
+// The above code will generate the following code once +// collect-static-const-decl and array-decl-desugar have runned. +// The problem is that the loop "hides" static const variables which +// are not caught by collect-static-const-decl.
+// const int N = 3; +// +// for __meta_i_0 from 0 to 2 step 1 do +// const int array[__meta_i_0] = 42; +// end +// +// module test +// for __meta_i_2 from 0 to 2 step 1 do +// x[__meta_i_2] : [0..N] init array[N]; +// end +// [] x[array[N]]=0 -> (x[array[N]]'=1); +// endmodule
Nice!
Rather than using comments, you should check in the genuine expected output, and compare your output to it. You may want to add option to your binary to check intermediate desugaring.
On 2006-06-05, Akim Demaille akim@lrde.epita.fr wrote:
"SIGOURE" == SIGOURE Benoit sigoure.benoit@lrde.epita.fr writes:
Index: tests/xrm/static-const-arrays-desugar.xpm --- tests/xrm/static-const-arrays-desugar.xpm (revision 0) +++ tests/xrm/static-const-arrays-desugar.xpm (revision 0) @@ -0,0 +1,26 @@ +const int N = 3; +const int array[N] = 42;
+module test
- x[N] : [0..N] init array[N];
- [] x[array[N]]=0 -> (x[array[N]]'=1);
+endmodule
+// The above code will generate the following code once +// collect-static-const-decl and array-decl-desugar have runned. +// The problem is that the loop "hides" static const variables which +// are not caught by collect-static-const-decl.
+// const int N = 3; +// +// for __meta_i_0 from 0 to 2 step 1 do +// const int array[__meta_i_0] = 42; +// end +// +// module test +// for __meta_i_2 from 0 to 2 step 1 do +// x[__meta_i_2] : [0..N] init array[N]; +// end +// [] x[array[N]]=0 -> (x[array[N]]'=1); +// endmodule
Nice!
Rather than using comments, you should check in the genuine expected output, and compare your output to it.
Yes but ATM this test fails, the comment within the test explains why it's failing.
You may want to add option to your binary to check intermediate desugaring.
Good point.