Loom¶
Submission for langjam#0001
I have been exploring literate programming and animation, the past few months so the langjam topic came as a surprise! While the initial goal was to build something like docco, I realised I could do an animation inside comments using a dsl. This is a prototype of an animated approach to literate programming first invented by Don Knuth. The code rendering time is long with terminalizer which I had not anticipated. There is an option that will strip code and store comment sequences inside a sqlite for fun and its used to explore a new metric of code quality - lines of comment / lines of code.
The animation dsl
dir/file1.py
# animation::<name>:no1
# ...
# ...
dir/file2.py
# animation::name:no
# ...
# ...
first-class comments (interpretation): treat comment sequences as a value that can be freely passed, stored, serialized … like python dictionaries + pickle or integers. A comment sequence is something separated by 0-width indentation of codeblocks for now.
Examples include - hello-world and fibonacci
Limitations - a lot!
Demo¶

Instructions¶
git clone https://github.com/xyzzyapps/loom.git
cd loom
virtualenv env
source env/bin/activate
pip install -r requirements.txt
Utilities for animation,
brew install cowsay
npm install -g terminalizer
python source/loom.py --generate-docs fibonacci build1 # builds the db and docco like docs with sphinx
python source/loom.py --comment-stats # previous step is needed to create the database
python source/loom.py --generate-terminal-show fibonacci build2 3 start
python source/loom.py --clean-source < hello-world/test.py
License Support¶
Unless stated otherwise, all source code in this document and the documentation itself is under the Creative Commons Attribution Non Commercial No Derivatives license.
About¶
I’m xyzzy! I’m a web developer into music and #creativeprogramming. I’m a solopreneur. Checkout my apps where I explore “procedural” literate programming to build practical apps. I have written a literate programming tool with the help of cog preprocessor called wheel. I am exploring 3d animation with blender and using python as a replacement for cpp in raptor these days ^_^