grammar update

Jason Orendorff jason.orendorff at
Wed Apr 2 12:46:11 PDT 2008

On Sun, Mar 30, 2008 at 7:29 PM, Jeff Dyer <jodyer at> wrote:
>  I've updated the ES4 grammar files linked from

Thanks for doing this.  I noticed that the grammar doesn't allow this:

    for each (user in users)
      if (user.isAdministrator)
        for each (addr in user.addresses)]

Is this intentional?  Both Python and Haskell allow the analogous
listcomp.  (Oddly enough, if you anti-optimize this, moving the
IfCondition to be after the last ForInExpression, the proposed ES4
grammar accepts that.)

Separately, I would appreciate let clauses in ArrayComprehensions:

  [[trial, phi]
    for each (trial in trials)
      let (phi = hugeExpensiveCalculation(trial))
        if (phi < 1000)]

Haskell has this feature.  I occasionally reach for it in Python and
it isn't there.


More information about the Es4-discuss mailing list