Arrow function syntax cover syntax
brendan at mozilla.org
Mon Apr 9 14:16:59 PDT 2012
Russell Leggett wrote:
> Or allow it in the grammar and then disallow it in the
> post-processing. IOW, a cover grammar doesn't have to force us to
> introduce new syntactic forms, they just force us to put them in
> the *grammar*. The post-processing, which essentially defines the
> two sub-grammars for the two separate contexts, can remove the
> syntactic forms we don't want to provide semantics for.
> Hmm...a deviously simple solution, and yet - it feels so wrong.
> Grammatically legal and yet illegal. I sense complaints by
> implementors. :)
Implementors all (AFAIK) use top-down parsers that have no problem
implementing left-hand-side expressions without reifying Reference
types, that is by validating a parse tree and throwing early errors on
illegal LHS of assignment, ++, etc.
There's still a smell if the cover grammar covers too much, but I think
'...' is tolerable. Thanks, Arv, for pointing this out.
More information about the es-discuss