Array syntax in Javalette

5 views
Skip to first unread message

Mattis Jeppsson

unread,
Apr 18, 2011, 10:38:52 AM4/18/11
to compiler-cons...@googlegroups.com
Hi,

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

Björn von Sydow

unread,
Apr 19, 2011, 4:55:31 AM4/19/11
to compiler-cons...@googlegroups.com
Hi,

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

Reply all
Reply to author
Forward
0 new messages