2023-12-17 21:23:14 +02:00
|
|
|
.. _full-grammar-specification:
|
|
|
|
|
|
2008-08-03 09:47:27 +00:00
|
|
|
Full Grammar specification
|
|
|
|
|
==========================
|
|
|
|
|
|
2020-07-27 19:20:36 +01:00
|
|
|
This is the full Python grammar, derived directly from the grammar
|
|
|
|
|
used to generate the CPython parser (see :source:`Grammar/python.gram`).
|
|
|
|
|
The version here omits details related to code generation and
|
|
|
|
|
error recovery.
|
2008-08-03 09:47:27 +00:00
|
|
|
|
2025-06-09 15:50:11 +02:00
|
|
|
The notation used here is the same as in the preceding docs,
|
|
|
|
|
and is described in the :ref:`notation <notation>` section,
|
2025-07-23 17:57:54 +02:00
|
|
|
except for an extra complication:
|
2025-06-09 15:50:11 +02:00
|
|
|
|
|
|
|
|
* ``~`` ("cut"): commit to the current alternative and fail the rule
|
|
|
|
|
even if this fails to parse
|
2020-07-27 19:20:36 +01:00
|
|
|
|
|
|
|
|
.. literalinclude:: ../../Grammar/python.gram
|
|
|
|
|
:language: peg
|