Nannying (was: Array comprehension syntax)
brendan at mozilla.com
Tue Sep 25 21:49:18 PDT 2012
Allen Wirfs-Brock wrote:
> So, from that perspective, why didn't you make it:
> '[' AssExpList ']'
> | '[' Exp FOR ID OF Exp IF Exp ']'
Because that is ambiguous, with a reduce/reduce conflict on lookahead ',':
3 AssExpList: AssExp .
5 Exp: AssExp .
FOR reduce using rule 5 (Exp)
',' reduce using rule 3 (AssExpList)
',' [reduce using rule 5 (Exp)]
$default reduce using rule 3 (AssExpList)
You can spot it by inspection given
| AssExpList ',' AssExp
| Exp ',' AssExp
More information about the es-discuss