python bytecode grammar

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


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

I believe the top-level production is something like
BYTECODE := (OPCODE ARGS)*
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 python.org.  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