A toy Piet interpreter in Python
Switch branches/tags
Nothing to show
Clone or download




Pyet is a toy interpreter for a restricted subset of the language Piet written in Python.

Pyet is also a testbed for me to learn and apply Python best practices, and as a result its structure may shift substantially from commit to commit.


The main Pyet script doesn't directly read image files, instead reading in a custom text representation of a Piet image. You can convert your Piet image file to a Pyet text representation using image_to_source.py as follows:

python3 image_to_source.py source.[jpg|png|gif] > source.pyet

Once you have your Pyet program, you can interpret it:

python3 pyet.py source.pyet

For more options, use the -h flag:

python pyet.py -h
Usage: python pyet.py [options] source_file

  -h, --help   show this help message and exit
  -d, --debug  print debugging information


Pyet does not yet support:

  • The "in" commands (char or int).
  • Specifying a codel size. Codels are 1 pixel.


  • Python 3.X
  • Pillow if you'd like to run image_to_source.py to convert an image to a Pyet source file