neogeny / TatSu

竜 TatSu generates Python parsers from grammars in a variation of EBNF

Home Page:https://tatsu.readthedocs.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Precedence is not taken correctly

zeilenschubser opened this issue · comments

Hi,

i have tried tatsu 4.4.0 from pip and 8e5a785 with a grammar taken from antlr/grammars-v4/python/python3/Python3Parser.g4.

There is a rule
trailer: '(' (arglist)? ')' | '[' subscriptlist ']' | '.' NAME;
On my System (Win10_64) this is grouped to
trailer: '(' (arglist)? (')' | '[') subscriptlist (']' | '.') NAME;
Is this the correct precedence order? or is grammarsv4 wrong?
All the other python2 and python3 grammars are implemented the same way.

Btw: i think since e1346b6 /tatsu/buffering.py https://github.com/neogeny/TatSu/blob/e1346b6f1a1e36407f5a5a94807a9f3d3f07714c/tatsu/buffering.py as there is no build possible with later versions.

The Python grammar was work in progress and no longer part of the distribution.

For a complete PEG grammar for Python look at the PEG parser in CPython >= 3.9.