SelectorNode selector() {
		IdentNode subject = constIdent();
		SelectorNode node = null;
		
		if (test(DOT)) {
		    read(DOT, ".");
		    node = new RecordSelectorNode(subject, constIdent());
		} else if (test(LBRAC)) {
		    read(LBRAC, "[");
		    node = new ArraySelectorNode(subject, expr());
            read(RBRAC, "]");
		} else {
		    failExpectation(". or [");
		}

		while (test(DOT) || test(LBRAC)) {
			if (test(DOT)) {
				read(DOT, ".");
				node = new RecordSelectorNode(node, constIdent());
			} else {
				read(LBRAC, "[");
				node = new ArraySelectorNode(node, expr());
				read(RBRAC, "]");
			}
		}

		return node;
	}