The electronic document generator


Novelang runs as a batch tool, or as an HTTP dæmon. Both use the same engine, passing URL-like requests (like /doc/Novelang.pdf).

The rendition of a document occurs through 3 mains stages:

  • Source parsing.
  • Tree mangling.
  • Rendering.

Source parsing

Source parsing is about reading a source files into an AST (Abstract Syntax Tree). The AST is made of nodes with a text payload, an optional type label, and zero or more children.

The parser relies on ANTLR-generated code.

Source parsing occurs in parallel when a single Opus file includes several Novella files.

Tree mangling

The tree mangling reorganizes the AST before rendering. This occurs in many steps.

Some of those steps are:

  • Integrating double-quoted text as n:url-literal inside n:url nodes.
  • Building hierarchies for levels and lists.
  • Finding identifiers and detecting identifier collisions.


Rendering converts the AST to a human-readable format, like PDF or HTML. There is a built-in renderer relying on XSL but as the Renderer is basically a function taking an output stream and an AST as input parameters, rendering can occur in virtually any format.

split the document into multiple pages (through a customizable stylesheet).


Novelang applies many features of functional programming. Most of Novelang’s internal components don’t retain any state past initialization. Most of data structures are immutable, especially the AST. (This required to develop specific algorithm to deal with immutable trees.)

Because Novelang’s code avoids unnecessary side-effects, this greatly improves its inherent stability.