From the spec:
and:
StatementList : ReturnStatement ExpressionStatement[~In]
is equivilant to:
StatementList : ReturnStatement ExpressionStatement
What is the point of the tilda prefixed parameter appended to non-terminals if there is no effect in the result?
You have to understand that equivalence in conjunction with the expansion for the +
prefix for grammatical parameters. E.g.,
`Foo[+In]` expands to `Foo_In`, and
`Foo[~In]` expands to `Foo`.
What's important is that [+In]
and [~In]
have different expansions. The particular expansions shown aren't that important; they're never used elsewhere in the spec. The syntax would be the same if the spec said:
`Foo[+In]` expands to `Foo_plusIn`, and
`Foo[~In]` expands to `Foo_tildeIn`.
or
`Foo[+In]` expands to `Foo+In`, and
`Foo[~In]` expands to `Foo~In`
(if we assume that the world of expanded nonterminals allows +
and ~
in non-terminal names).
Personally, I think a more symmetric expansion (like the alternatives above) would be less weird for the reader.
Thanks for your reply. I understand what you are saying.