mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 05:31:20 +00:00 
			
		
		
		
	 e6b2d93f0c
			
		
	
	
		e6b2d93f0c
		
			
		
	
	
	
	
		
			
			(We censor the heck out of actions and some other stuff using a custom "highlighter".)
(cherry picked from commit 72cabb2aa6)
Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
		
	
			
		
			
				
	
	
		
			19 lines
		
	
	
	
		
			848 B
		
	
	
	
		
			ReStructuredText
		
	
	
	
	
	
			
		
		
	
	
			19 lines
		
	
	
	
		
			848 B
		
	
	
	
		
			ReStructuredText
		
	
	
	
	
	
| Full Grammar specification
 | |
| ==========================
 | |
| 
 | |
| 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.
 | |
| 
 | |
| The notation is a mixture of `EBNF
 | |
| <https://en.wikipedia.org/wiki/Extended_Backus%E2%80%93Naur_form>`_
 | |
| and `PEG <https://en.wikipedia.org/wiki/Parsing_expression_grammar>`_.
 | |
| In particular, ``&`` followed by a symbol, token or parenthesized
 | |
| group indicates a positive lookahead (i.e., is required to match but
 | |
| not consumed), while ``!`` indicates a negative lookahead (i.e., is
 | |
| required _not_ to match).  We use the ``|`` separator to mean PEG's
 | |
| "ordered choice" (written as ``/`` in traditional PEG grammars).
 | |
| 
 | |
| .. literalinclude:: ../../Grammar/python.gram
 | |
|   :language: peg
 |