Home Directory / Slit

Slit - Simple literate programming tool

A cross-platform, cross-system literate programming tool

 

Table of contents

Introduction

Slit is a literate programming tool. Literate programming is a particular approach to programming introduced by Donald Knuth. For a introduction you can read the wikipedia article for Literate Programming.

To keep a long story short in literate programming you reverse the relation between code and documentation: usually you write commented code (you comment your code, right?); with literate programming you write your code in the documentation.

Just to clarify your ideas let's show a simple flow-chart:

Slit example flowchart

As you see in the diagram you write a documentation file (documentation can obviously span to multiple files) and Slit will generate for you the documentation and the source code of your program.

When you are writing you can expose the code in the format you need for explaining the functionalities and then compose it in multiple source files using the Slit directives.

Let's see a simple example just to fix ideas:

Let's suppose I want to write a simple C program to say
hello to the world. I could start with something like this:

    @f main.c
    @{
    @<include lines@>
    
    int main(int argc, char **argv) {
      @<will do something here@>
    }
    @}

Well.. I want to print hello world using printf so I will need to
include stdio.h:

    @d include lines
    @{
    #include <stdio.h>
    @}
    
Yeah. Let's say hello to the world:

    @d will do something here
    @{
    printf("Hello world!\n");
    @}
    

This little literate program will generate a "main.c" file like this:

#include <stdio.h>

int main(int argc, char **argv) {
  printf("Hello world!\n");
}

Features

Slit can be used with Linux and with Windows. You can generate documentation in multiple formats such as:

Downloads

Slit is released under GPL license and you can download and view it's code and documentation here at BitBucket

Acknowledgement

Thanks to all!

Contacts

You can concact the author via e-mail: leonardoNOSPAMce@interfree.it (please remove NOSPAM from the email address)