A toy compiler that can convert Python scripts to pickle bytecode

Pickora

A small compiler that can convert Python scripts to pickle bytecode.

Requirements

No third-party modules are required.

Usage

usage: pickora.py [-h] [-d] [-r] [-o OUTPUT] file

A toy compiler that can convert Python scripts to pickle bytecode.

positional arguments:
  file                  the Python script to compile

optional arguments:
  -h, --help            show this help message and exit
  -d, --dis             disassamble compiled pickle bytecode
  -r, --eval, --run     run the pickle bytecode
  -o OUTPUT, --output OUTPUT
                        Write compiled pickle to file

For exmple, you can run:

python3 pickora.py -d samples/hello.py -o output.pkl

to compile samples/hello.py to output.pkl and show the disassamble result of the compiled pickle bytecode.

But this won’t run the pickle for you. If you want you should add -r option, or execute

 

 

 

To finish reading, please visit source site