We are working on a new version of a JavaScript grammar using Rascal. Based on the language specification (version 6) and existing JavaScript grammars, the following are valid productions for expressions:
syntax Expression = ...
| new: "new" Expression
| call: Expression Args
syntax Args = ...
However, when we try to parse an expression like "new Date().getTime()" we get an Ambiguity error. We tried to fix it using a combination of the "left" and ">" operators, something like
| left "new" Expression
> Expression Args
but we were not able to fix the problem. I believe that this might be simple to solve, but after spending a couple of hours, we could not figure out a solution.