Overview: Processing Model

With all the LaTeX libraries available at CTAN, it would be impossible for Nyarna to cover even a small percentage of functionality available for LaTeX, would it start to build up its own ecosystem. Thus, Nyarna's processing model has been designed for leveraging existing technology. Nyarna's command line interface specifically caters towards interaction with other tools.

Nyarna takes one main module (usually a file) as input. From this, Nyarna generates a document. This is the first processing step, which also checks your input against its declared schema, thus validating it.

The main module you give can refer to other modules, including such modules that could be processed standalone. These will then be imported and become part of the input. The main module may also define parameters for which arguments can be given, which gives Nyarna capabilities similar to those of a templating processor.

The second step is to create output from the generated document. You can generate any number of named outputs, each of which usually contains plain text again. A typical use-case would be to generate one or more .tex files that can then be further processed with LaTeX. Nyarna doesn't predefine what kind of files and text formats can be generated, so you can implement a backend for any format you need. This way, Nyarna can be used on top of existing technology.

The separation of those two steps has a couple of implications: Firstly, to check your document, you do not need to process it completely, like you would do in LaTeX. It suffices to execute the first step. This makes checking input faster and has good potential to be used in editor tooling.

Furthermore, you can select the implementation used for the second step, so that you can, from the same input, generate different outputs. For example, you could, from the same input, generate either LaTeX or HTML, using the suitable backend. Besides targeting different formats for presenting your document, this can also be used for tooling. For example, you could use a backend that reduces your input to plain text without any markup, which you can then pipe into tools that check for spelling and grammar.

Finally, this design allows you to write once: Even after you have written your input, if you need the contained data in a new format, you have the full flexibility of adding a new backend that transforms the existing input into that format. You won't have to rewrite your input manually.

input module arguments imported modules eval initial document process output documents
Processing a Nyarna input module