Skip to content

Grammar rules in proposed spec text seem incomplete #290

Open
@sethbrenith

Description

@sethbrenith

Based on the description in README.md, it seems that the pipeline operator is intended to be left-associative: a |> b |> c is equivalent to (a |> b) |> c. The proposed spec text defines the following production:

    PipeExpression[In, Yield, Await] :
      ShortCircuitExpression[?In, ?Yield, ?Await] |> PipeBody[?In, ?Yield, ?Await]

However, the proposed text does not include any rules for how ShortCircuitExpression can be a PipeExpression, which I assume would be necessary for parsing a |> b |> c.

Furthermore, in order for the grammar to be unambiguous, the right side of the PipeExpression production should be something which can't be a PipeExpression. If we assume ShortCircuitExpression can be a PipeExpression, then PipeBody can also be a PipeExpression with the current production rules, which causes ambiguity. I expect the production to be of the form:

    PipeExpression :
      SomethingWhichCanBeAPipeExpression |> SomethingWhichCannotBeAPipeExpression

I expect it will be somewhat difficult to define unambiguous grammar rules for a new left-associative operator which is at the same precedence level as a bunch of existing right-associative operators; this may be indicative of a fundamental problem with the currently proposed precedence level.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn’t working as intended in spec

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions