The trouble with ambiguous grammars

Waldemar Horwat waldemar at
Fri Oct 17 16:16:49 PDT 2008

Brendan Eich wrote:
> On Oct 17, 2008, at 3:47 PM, Brendan Eich wrote:
>> On Oct 17, 2008, at 3:39 PM, Brendan Eich wrote:
>> Er, you are right, I should have acknowedged this point. The rest of
>> my post is about x++() not being a valid sentence, which supports your
>> argument.
>> While we don't have any usability problems, and torturous statements
>> such as
>> let (a = 1) a ? f : x++();
>> are not written by real users (they'd parenthesize to clear up
>> things), I agree that we don't want the "prove a negative" problem.

It can rear up accidentally with semicolon insertion.  Split the example across two lines:

let (a = 1) a ? f : x++

> This shows a problem with ES4's reliance on top-down parser 
> construction. We never created an LR(1) grammar (ignoring ASI and the 
> other exceptions that don't fit in LR-anything, and solving dangling 
> else as is customary). To avoid the "prove a negative" problem, we need 
> one. IIRC you have one -- can you share it via

The old ES4 grammar is machine-verified LR(1).  It's on:


More information about the Es-discuss mailing list