https://svn.lrde.epita.fr/svn/xrm/trunk
Index: ChangeLog
from SIGOURE Benoit <sigoure.benoit(a)lrde.epita.fr>
Fix the size of generated arrays.
* src/str/array-decl-desugar.str: Stick with the C-style array
convention. (that is: array[N] has values ranging from array[0]
to array[N-1])
array-decl-desugar.str | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
Index: src/str/array-decl-desugar.str
--- src/str/array-decl-desugar.str (revision 34)
+++ src/str/array-decl-desugar.str (working copy)
@@ -45,13 +45,17 @@
/* find the first element in the list which matches ?Int(_)
* eg: [Identifier("..."), Int("1"), Int("2")] will be
transformed in
* ([Identifier("...")], Int("1"), [Int("2")]) */
- ; <split-fetch-keep(?Int(_))> dims' => (dims-done, current-dim,
dims-todo)
+ ; <split-fetch-keep(?Int(_))> dims'
+ => (dims-done, Int(current-dim), dims-todo)
+
+ /* array[N] has N elements ranging from 0 to N-1 */
+ ; <subtS>(current-dim, "1") => current-dim'
/* replace the dimension we're working on by the meta-var */
; <concat> [dims-done, [Identifier(x)], dims-todo]
/* return the result in a tuple */
- ; !(x, current-dim, <id>)
+ ; !(x, Int(current-dim'), <id>)
rules
// FIXME: Try to figure out why concrete syntax fails to work here