IppClub / IppClub/YueScript

Precedence of pipeline operator with list syntax w/o explicit line continuation

Open
#138 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Lua
Stars
613
Forks
45
PR merge metrics
No merged PRs in 30d

Description

Right now, if I compile this code:

f
  * a
    |> b

the resulting Lua is:

return b(f({ -- 2
  a -- 2
})) -- 2

This is the opposite of what I'd expect: based on the indentation, I would've thought it would be parsed as f({ a|> b }), not f({ a }) |> b. If I use an explicit slash:

f
  * a \
    |> b

then it compiles like I'd expect:

return f({ -- 2
  b(a) -- 2
}) -- 3

I'm not sure if this is intentional? But it was certainly rather confusing 😅

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the two examples from the issue and compare their generated Lua, first checking the parser or precedence handling for list syntax, pipeline operators, and explicit line continuation. Done means the no-slash form follows the indentation-based interpretation described in the issue, with regression coverage for both forms.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.