On 2006-06-05, Akim Demaille <akim(a)lrde.epita.fr> wrote:
>>
"SIGOURE" == SIGOURE Benoit <sigoure.benoit(a)lrde.epita.fr> writes:
Add array declarations (sugar).
It is now possible to declare arrays such as: b[4][3] : bool;
Multi-dimensional arrays are correctly handled.
This is really nice. I would like to emphasize, though, that, unless
you plan to make "b[4]" actually mean something here, the user would
rather write b[4, 3]. Again, that's only sugar.
This would conflict with the recent extensions of the grammar.
+ /**
+ ** Patch the list of dimensions with the meta-var used in the meta for loop.
+ ** Basically this strategy generates a new meta-var used as the iterator
+ ** in the meta-for loop and updates the dimensions of the declared array.
+ ** The dimension updated is the first one matching Int(_)
A minor nit: Please don't forget the ending period for sentences.
That's a frequent mistake.
OK.
+// FIXME: Try to figure out why concrete syntax
fails to work here
You bet!
xrm-to-prism =
/* remove XRM sugar, normalize some nodes */
- topdown(try(xrm-to-prism-desugar))
+ innermost(xrm-to-prism-desugar)
What made you change this?
innermost is simply more appropriate. It works in a bottom-up fashion, which
is the correct traversal for desugaring (eg: in x=1+2 you want to reduce 1+2
as 3 and then try to see if more can be done).
Also, the innermost strategy is one of those "fixpoint" strategy, that is, if
the strategy given in argument succeeds, it will be called recursively on the
new current term until it fails.
Index: tests/xrm/globals.xpm
--- tests/xrm/globals.xpm (revision 0)
+++ tests/xrm/globals.xpm (revision 0)
@@ -0,0 +1,3 @@
+for i from 0 to 4 do
+ global x[i] : bool;
+end
I don't really understand how works your test suite. Shouldn't you be
also checking in the expected output?
Yes I should. This is in the TODO list.
ATM the test suite only check that none of the binaries used fail and that
generated code can be parsed by a parse-prism.
--
SIGOURE Benoit aka Tsuna
_____
/EPITA\ Promo 2008.CSI Rock & tRoll