I was on the hunt for building diagrams declaratively and figured that tangling it Prolog might be the way.

It works for me and though I'd share. It won't save you from learning (some) Prolog and Pikchr though :)