Important:Pyodide takes time to initialize.
Initialization completion is indicated by a red border around Run all button.
We previous discussed how to extract the control flow graph
from the Python AST. However, the Python AST can change from version to version, with the introduction
of new control flow structures. The byte code, in comparison, stays relatively stable. Hence, we can
use the bytecode to recover the control flow graph too.
First, we need the following imports. The dis package gives us access to the Python disassembly, and
networkx and matplotlib lets us draw.
System Imports
These are available from Pyodide, but you may wish to make sure that they are
installed if you are attempting to run the program directly on the machine.
matplotlib
networkx
We also need pydot for drawing
Available Packages
These are packages that refer either to my previous posts or to pure python
packages that I have compiled, and is available in the below locations. As
before, install them if you need to run the program directly on the machine.