Live data from Hacker News

Noweb – A Simple, Extensible Tool for Literate Programming

cs.tufts.edu

31–40 of 54 posts

Re: Noweb – A Simple, Extensible Tool for Literate Programming

#31
post #19

(BTW, Norman's server seems to be suffering under the load; https://web.archive.org/web/20210223015500/https://www.cs.tu... has your (Way)Back if you're suffering problems in accessing it.) I've been interested in literate programming for a long time; for my self-bootstrapping PEG parser https://github.com/kragen/peg-bootstrap/blob/master/peg.md I wrote my own noweb-like system called HandAxeWeb in Lua (5.x) https://…

Here are a couple more projects that may or may not seem like Literate Programming, but are motivated squarely by its ethos: to order code for exposition, independent of what the compiler wants.

* https://github.com/snaptoken, the engine behind https://viewsourcecode.org/snaptoken/kilo. The key new feature here seems to be that fragments are always shown in context that can be dynamically expanded by the reader.

* https://github.com/jbyuki/ntangle.vim -- a literate system that tangles your code behind the scenes every time you :wq in Vim or Neovim.

* My system of layers deemphasizes typesetting and is designed to work within a programmer's editor (though IDEs will find it confusing): http://akkartik.name/post/wart-layers. I don't have a single repo for it, mostly[1] because it's tiny enough to get bundled with each of my projects. Perhaps the most developed place to check out is the layered organization for a text editor I built in a statement-oriented language with built-in support for layers: https://github.com/akkartik/mu1/tree/master/edit#readme. It's also in my most recent project, though it's only used in a tiny bootstrapping shim before I wormhole solipsistically into my own universe: https://github.com/akkartik/mu/blob/main/tools/tangle.readme.... Maybe one day I'll have layers in this universe.

[1] And also because I think example repos are under-explored compared to constant attempts at reusable components: http://akkartik.name/post/four-repos

Re: Noweb – A Simple, Extensible Tool for Literate Programming

#32
I picked up https://smile.amazon.com/gp/product/1541259335 recently. It is a somewhat short program for MP3 written in a literate way. Is a very good argument for the practice.

At the same time, it is a decent argument against the practice. Most programs are not linear in the "why" and are instead many many many competing priorities for why something was done the way it was. Moreso if you consider codebases with more than a few contributors. Especially so if they are all conceptually contributing.

Which makes sense if you think of most creative books. You will have many contributors, but the narrative is usually split between a very small number of authors. Most contributions are in supporting art, editing, or general feedback. To move programming to a similar space, would require working with contributions in a similar way. (Last is clearly an assertion.)

Re: Noweb – A Simple, Extensible Tool for Literate Programming

#33
post #19

(BTW, Norman's server seems to be suffering under the load; https://web.archive.org/web/20210223015500/https://www.cs.tu... has your (Way)Back if you're suffering problems in accessing it.) I've been interested in literate programming for a long time; for my self-bootstrapping PEG parser https://github.com/kragen/peg-bootstrap/blob/master/peg.md I wrote my own noweb-like system called HandAxeWeb in Lua (5.x) https://…

Here are a couple more projects that may or may not seem like Literate Programming, but are motivated squarely by its ethos: to order code for exposition, independent of what the compiler wants. * https://github.com/snaptoken , the engine behind https://viewsourcecode.org/snaptoken/kilo . The key new feature here seems to be that fragments are always shown in context that can be dynamically expanded by the reader. *…

These are great, thank you!

Re: Noweb – A Simple, Extensible Tool for Literate Programming

#34
post #23

One of the problems with literate programming is that everyone who wants to write literate programs seems to want to write their own literate programming system. This was the conclusion of a short-lived (running to 5 issues) column of literate programs in the Communications of the ACM (1987–1990), by Christopher J. Van Wyk: > Unfortunately, no one has yet volunteered to write a program using another’s system for lite…

I actually have made it a point of order to try and pick up all literate programs in book form that I can. This one, is particularly dense, and big. So I have not made too much progress. :(

I have made better progress in the MP3 book. Which, I have enjoyed. Same for the Stanford Graphbase.

It is frustrating, as I am not a fan of c, all told. And I have not found any lisp literate programs. If you know of any, I'd be very interested.

Re: Noweb – A Simple, Extensible Tool for Literate Programming

#35
post #9

Literate Programming is one of those ideas I keep coming to. There is an idea there that touches on something I find to be true about software development, namely that the communication of an idea to other humans is the most critical piece. There is a similar idea in Naur's paper "Programming as Theory Building." That said, I've never loved the LaTeX-centric nature of most tools. I don't like heavier markup systems w…

I found Mr. Ross' funnelweb utility to have the best syntax. Unique and easy to read. http://ross.net/funnelweb/tutorial/index.html Unfortunately the only known implementation was last updated over two decades ago, and is written in pretty hard to understand C. I asked for permission and started a repository here: https://github.com/loa-in-/fw-utf8 I currently have it unmodified there, except for disabled check for A…

It's unfortunate that Funnelweb itself wasn't written in a literate style!

Re: Noweb – A Simple, Extensible Tool for Literate Programming

#36
post #5

I am working on a tool, which can take a collection of MarkDown files with fragments of C code, and can combine these into a single C file, where all fragments are placed in an order, such that they can be compiled. Because defines can change the meaning of code depending where you place them, there are some restrictions on the input files. An example of the type of input file I have in mind, is given at https://gith…

This sounds a lot like the R Markdown format. https://rmarkdown.rstudio.com/articles_intro.html

Re: Noweb – A Simple, Extensible Tool for Literate Programming

#37
post #27

Is there a simple intro an ELI5 to get into or learn literate programming? My current understanding is that if write a paragraph size of comments to explain each and every part of my code with its intent it will be called literate programming.

It depends a lot on what you imagine writing with literate programming, and, like all documentation, who you imagine the reader to be. When I (used to) write literate programs, the document I produced would be some kind of top-down view of the functionality. I would begin by explaining the kind of problem to be solved and include motivating examples. Then I would explain the structure of the solution and start writin…

While I agree that things are less necessary in a modern language, I disagree that Java is "unconstrained." This is especially false when one considers that the "entry point" to your code is more dependent on how the framework you are using calls it.

It gets laughable when you have codebases that have "gone all in (functional|object oriented|any other style)" where they seem to mistake the style for the goal, which should be to solve a problem. (I say this as someone that is pretty sure I have made those mistakes.)

Re: Noweb – A Simple, Extensible Tool for Literate Programming

#38

Is there a simple intro an ELI5 to get into or learn literate programming? My current understanding is that if write a paragraph size of comments to explain each and every part of my code with its intent it will be called literate programming.

There's Knuth's TeX Book and METAFONT Book, and his Stanford GraphBase book. There's also his collection of papers, Literate Programming (https://www.amazon.com/gp/product/0937073806/ref=dbs_a_def_r...).

Knuth has an LP web page (https://www-cs-faculty.stanford.edu/~knuth/lp.html), but it looks like the examples are out of date.

Probably more useful is http://www.literateprogramming.com/; the CWEB Tool page has some examples and the PDF Articles page has ... articles.

Here's an intro from Knuth: http://www.literateprogramming.com/knuthweb.pdf

And then there's Physically Based Rendering at http://www.pbr-book.org/.

Re: Noweb – A Simple, Extensible Tool for Literate Programming

#39
post #3

Literate Programming is one of those ideas I keep coming to. There is an idea there that touches on something I find to be true about software development, namely that the communication of an idea to other humans is the most critical piece. There is a similar idea in Naur's paper "Programming as Theory Building." That said, I've never loved the LaTeX-centric nature of most tools. I don't like heavier markup systems w…

Obligatory shilling of Org-babel, for those using Emacs and Org-mode: https://orgmode.org/worg/org-contrib/babel/

I've been using Org for a little over a year, and it's actually quite nice. To support a blog post last year (https://reindeereffect.github.io/2020/05/05/index.html) I did my own quick and dirty rendition of chunk labels, chunk chain navigation, and clickable references.

Lately I've built a faster, mostly drop-in replacement for org-babel-tangle (that doesn't unnecessarily clobber files that haven't changed); and I'm finishing up a more complete chunk formatter for HTML export, along with usable chunk index generation. Once that's done, I'll quit nerd sniping myself on literate programming systems for awhile and finish up a missive on programming a Turing machine to solve the Towers of Hanoi.

Post reply on HN