Small Project: Crycco, a literate programming tool
I have fun in weird ways.
For example, I may read about a tool and then decide to translate a clone of the tool from one programming language to another. And then after it works but the code is awful, rewrite it, then release it
In a weekend. It helps that the thing is small (under 200LOC) but it's still an indication that I am having fun doing it.
So, what is it? I wrote Crycco, a Crystal tool similar to Docco, which is a literate programming tool.
A what?
A literate programming tool. Meaning a tool that lets you:
- Generate a program's code out of a document
- Generate a document out of a program's code
- Generate a document and a program's code out of a "literate document"
That may be doing the opposite of explaining what it actually does, so here's an example.
I wrote Crycco which if you look at it looks like a normal, although very heavily commented crystal program.
But if you pass the source code for Crycco through crycco it produces the crycco website ... go take a look!
As you can see it's a detailed explanation of what the program does and how the code works. It's the same thing only presented differently.
It's much easier to follow the explanations when they run alongside the code rather than interrupting it, isn't it?
Let's see another example. Crycco uses a YAML
file for some aspects of
its configuration. Usually I would just add some comments and tell you to
go and read the file.
But that would present you with ... well, YAML and comments. Github does an admirable job conveying that data, but compare it with Crycco's languages.yml
What do you think is easier to read and more understandable?
So, there it is, and it's pretty usable, even if I still want to extend it in some ways (like... let's generate Markdown! And use that to generate a PDF! Like it's 1989 and we are using nuweb!)
Yes, literate programming has been dead for a couple of decades, but it's far from a worthless idea. It can be used, it can be used purposefully and be valuable, and I have ideas that can be achieved using Crycco or a similar tool.
Hope it's useful for someone else too.