Are compound expressions like f()[0] (where f is a function returning
an array) valid syntax in Javalette with arrays?
I have looked in the project description and in the testsuite but
neither mention this.
Regards,
Mattis
this is a very good question! As you say, there is no indication in the specification of the project as to what forms of expressions one can index. As you also say, the test programs use only very limited syntax (only identifiers are indexed).
In situations like this, you should feel free to apply reasonable restrictions on the syntax. Of course, "reasonable" is not well defined, but I think one recognises an unreasonable restriction when one sees it. In particular, it is not necessary to be able to handle your example f()[0]. But you should, of course, think through the matter: where would problems occur if you allow it? In the parser? The typechecker? The code generator?
Best regards
Björn