Array support
PHPIL currently has no support for PHP arrays. This covers both construction syntax and element access, all of which are valid PHP but will currently either fail to parse or crash at the IL emission stage.
Construction syntax: PHP has two equivalent forms for constructing arrays, both of which need parser and IL support:
// Long form
array();
array('key' => 'value', 'other' => 1);
// Short form (identical semantics)
[];
['key' => 'value', 'other' => 1];
Both forms support mixed arrays; entries can be keyed ('key' => value), unkeyed (value), or a mix of both. Unkeyed entries receive an auto-incremented integer key, matching PHP's behaviour.
Element access: reading from and writing to array slots by key:
$users = load_users();
$users[0]; // integer key
$users['name']; // string key
$users[0] = 'John'; // assignment
What's needed
array(...) and [...] forms)ArrayLiteralNode to represent a constructed array, holding an ordered list of key/value pairs where the key is optionalArrayAccessNode to represent $arr[expr]PhpArray) that wraps Dictionary<PhpValue, PhpValue> while preserving insertion order for integer-keyed entriesVariableAssignment will need updating to handle $arr[key] = value as an assignment target