python bytecode grammar

Terry Reedy tjreedy at
Fri Jun 10 19:56:42 CEST 2005

"M1st0" <mistobaan at> wrote in message 
news:1118406741.403982.319720 at
> where I can find the grammar of python bytecode ? ( better if is in BCF

I believe the top-level production is something like
See the documentation for the dis module for symbolic opcodes and 
corresponding args.

Looking for patterns in bytecodes is one way CPython has been sped up. 
Previous results have occasionally been reported on the Python development 
list, archived somewhere at  Examples I remember are the 
frequencies of both individual bytecodes and of pair of codes.

For parse trees, you should look at the parser and compiler modules.

Terry J. Reedy

More information about the Python-list mailing list