I’m working on an implementation to transform the current Python PEG grammar to an ANTLR4 grammar.
The PEG grammar has a lot of
!e lookahead expressions.
My impression is that these expressions have no grammatical role.
I think that they are included in the PEG grammar only to increase the parsing speed as there is a reference to this in the comment of the following rule:
simple_stmts: | simple_stmt !';' NEWLINE # Not needed, there for speedup | ';'.simple_stmt+ [';'] NEWLINE
Furthermore, if I omit the implementation of lookahead expressions (by semantic predicates in ANTLR4) from the translated ANTLR4 grammar, it seems to me that it parses the Python source codes without any problems.
Do I understand these correctly?