title | author |
---|---|
Abacus emulator |
Antony C Chan |
Chinese emulator to learn computer microprogramming
Demo: https://antonysigma.github.io/_static/abacus-bin/
This example is written in a style of literate programming (Knuth 1984). The (Javascript) source code is not presented in one go. Instead, we present the code fragments embed within the main article.
The same article is also hosted on Github at https://github.com/antonysigma/abacus-emu/blob/entangled-bootstrap/lit/ .
The document pre-processor application, entangled
, will parse a system of code fragment references, known as noweb
(Ramsey 1994), to assemble the machine-readable source files.
Inside source fragments you may encounter a line with <<...>>
marks, which is a reference to another code fragment in the article.
Literate programming requires the machine code to be scattered throughout the main article written in plain English, following the human expert's train of thought. This is in stark contrast to the inline comment blocks scattered among the machine code files, following the machine logic flow.
-
Download the Entangled code generator.
-
Run
path/to/entangled-1.2.4/bin/entangled tangle -a
from the current directory to generate the main control scriptsrc/main.js
. -
(Optional) Generate the one-page documentation by
make site
. -
Run
make depend
to download all WebGUI dependencies. -
Run
make build
to compile and bundle all scripts to the output folderstatic/
-
Open the webpage
static/index.html
from the web browser. Enjoy!