0

In EBNF notation I see many => but cannot find a description. I googled and read some PDF and Wikipedia, but still no clue.

assignmentExpression:
    (leftHandSideExpression assignmentOperator) =>
    leftHandSideExpression assignmentOperator assignmentExpression
    | conditionalExpression
    ;
exebook
  • 32,014
  • 33
  • 141
  • 226
  • 1
    What is using this kind of EBNF notation? That might help. I'm surprised there wasn't a description of how this notation is used in whatever used it as there are many different EBNF variants in use. Some people even make up their own, like the authors of various programming languages (e.g. Python), the W3C who maintains the definition(s) of XML, and the IETF has their own variant named ABNF, never mind the international standard ISO/IEC 14977 that I've rarely seen used. The notation in your question is unfamiliar to me; it might very well be another EBNF notation. –  May 08 '17 at 00:16

1 Answers1

2

My guess is, it's a hint or directive to the parser (probably recursive-descent). E.g., if you're trying to parse an assignmentExpression, and you can parse a prefix of the pending input as leftHandSideExpression assignmentOperator, then commit to parsing the leftHandSideExpression assignmentOperator assignmentExpression alternative of assignmentExpression.

Michael Dyck
  • 2,153
  • 1
  • 14
  • 18
  • 1
    Agreed. Perhaps an example could improve your answer: `x = $;` should generate a syntax error saying `$` is found where an assignment expression was expected. Without the hint, the syntax error might complain about the `=` instead. –  Jul 03 '17 at 15:31