Literate
A Flexible Literate Programming System
View the literate source code for Literate!
View the literate source code for this website!
See the Github page.
What is Literate Programming?
Literate programming is a style of programming invented by Donald Knuth, where the main idea is that a program's source code is made primarily to be read and understood by other people, and secondarily to be executed by the computer.
This frees the programmer from the structure of a program imposed by the computer and means that the programmer can develop programs in the order of the flow of their thoughts.
A Literate program consists of explanation of the code in a natural language such as English, interspersed with snippets of code to be executed. This means that Literate programs are very easy to understand and share, as all the code is well explained.
Literate, a tool for literate programming, will allow you to take a literate source file (*.lit
) and either tangle the source file which will create a file with executable code, or weave the source file, which will generate an HTML document to be read as formatted documentation.
Features of this tool
Literate works with any programming language, generates HTML as output (
which can be converted to pdf), and generates readable code. The code that is generated is indented properly and is automatically commented using the titles you have written for the code blocks.
Here is the full list of features:
- Supports any language including syntax highlighting and pretty printing in HTML
- Generates HTML as output
- Generates readable code and commented in the target language
- Reports syntax errors back from the compiler to the right line in the literate source
- Runs fast -- wc.lit compiled for me in 7ms for both code and html output
- Markdown based -- very easy to read and write Literate source.
- Automatically generates hyperlinks between code sections
- Formatted output similar to CWEB
- Creates an index with identifiers used (you need to have exuberant or universal ctags installed to use this feature)
- Supports TeX equations with
$
notation - Compatible with Vim (literate.vim)
- Highly customizable
You can get started by taking a look at the
manual. In addition, this website is made with Literate, and the source can be read
here.
from Hacker News https://ift.tt/3r97kLc
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.