I showed you my source code, pls respond
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

1.9 KiB

Literate Programming

  • Programming paradigm

  • Programs expressed in natural language with code snippets

  • Produces machine readable code and human readable documentation

Introduction

Described in its introduction1 as a

Programming paradigm in which a computer program is given an explanation of its logic in a natural language, such as English, interspersed with snippets of macros and traditional source code, from which compilable source code can be generated.

Knuth describes a practitioner in the introduction of his 1984 paper1 as

An essayist concerned with exposition and excellence of style. Someone who carefully selects the name for each variable and describes their meaning. They will strive for a program that is comprehensible because concepts are introduced in a manner best for human understanding.

Concept

                     _____
                    |     | -> Send to Boss
 _____              | doc | -> Copy to Team
|     | -> Weave -> |_____| -> Copy to Support
| org |               _____
|_____| -> Tangle -> |     | -> Test on CI
                     | src | -> Copy to CDN
                     |_____| -> Send to Customer

Illustrated above we see the process of weaving and tangling the literate source file, and how each of the produced components is handled respectively.

File Description
org Literate document / file
src Machine readable source code
doc Human readable documentation

Resources


1

Knuth, D. E. (1984). Literate Programming. The Computer Journal, 27(2), 97–111. https://doi.org/10.1093/comjnl/27.2.97