<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/59151>59151</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Confusing error reporting while parsing a nested pass pipeline
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            bug,
            mlir:core
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          shabalind
      </td>
    </tr>
</table>

<pre>
    I'm currently working on a project thatĀ invokes MLIR a pass pipeline using Python bindings:
```python
mypm = pm.PassManager.parse(f"""builtin.module(
    mypass1,
    func.func(mypass2,mypass3)
)""")
```
Somewhat surprisingly this pass pipeline is not valid according to the pipeline parser, it tells me to add `,` at the end after `func.func(...)`. At the same time if you do add that comma, it errors as well since there is no valid pass name after the comma. 

As a workaround I added a dummy pass that does nothing just to make it happy:
```python
mypm = pm.PassManager.parse(f"""builtin.module(
    mypass1,
    func.func(mypass2,mypass3),
    dummy-do-nothing-pass
)""")
```
It would be great if this was not necessary in the first place, and parser accepted the initial snippet right away.

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzNVE1vnDAQ_TVwGS3iYyHhwGG7UaWVGilqf4HBAzgxtmWbrPj3HRuipD312JXXYHv85r3nMb3mW3dLyocFhtVaVF5ucNf2TagJtAIGxupXHDz4mfnkWiaXXKh3_YYOnn_cfoYA5hwYYVAKhbC6sPNl8zPt7oXiNHRJdUnypyS_JE2-NxMD9sllMwsk1ROYJXshsGem2IQ2M8w6TMrHMSnLvfWrkF6obNF8lWFpBwD6EQhtLZLy-jk3rmrIQkeR-zqBXPe3KinbgxO9fCT4nPwgug9_6QXvZAC41Rorgkbyyc_C_SWfJpT28M6k4MCGQdtgAHhNwfgZFqVZIgOCnEUpHSwYohjnELKSjCYH5uM2VIQ1erRh6auoLMsC4ybP4LKHOhZwBHVihE2vwHfMcHow6GVhR1K0VlsHzMGd0gMpGjAg2EPDISGqUwF0JxByRJgMDqNifyGkWDbM6pXY3kJSJNbA12XZdpjIgWuMFs3BltfV-aB6YW8YSM3MmO1_LZavwVHVievToeQUov69nG6ezFolhx5hski20GnFarqzvYAUDugcsxsIFU0fhSWvjGQDhhNkih9FFKoMjUcew4QSXjA6TyWMQQ9WTLMHdmdbtqdOsSuapi3z8lxXKe8q3lYtS73wErurVuN-gWN5gEWjrQ_j-yzkXrZhxIifCyn_KP50tbKbvTfxvpffqU3Cz2ufUcXQQMr3j8fp-KrQUDi3oqOXui3qIp27M2I9jmXD874fGNFkRVs8PNT8nDdDTaQl61G6Lqm_xVOeotFXoMcihaXcdOswTNZPqehIaVkUZUX_vK6ytq7H4dzkBD307eOQnHNcmJBZoJVpO6W2iwwJ2NGiFM67z0XSKyaFGLMTPlupNG3nZtbTfVE8jXK6qOU3BfO2ig">