Parsing, rendering, and modes

The following subsections explain at a high level the two phases involved in transforming a skool file (and its related ref files) into HTML or ASM format: parsing and rendering. These subsections also introduce some terminology that will be used in later sections.

Parsing

In the first phase, the skool file is parsed. Parsing a skool file entails reading each line of the file, and processing any relevant skool directives and ASM directives that are found along the way.

After a skool directive or ASM directive has been processed, it is discarded, so that it cannot be ‘seen’ during the rendering phase. The purpose of the skool directives and ASM directives is to transform the skool file into something suitable for rendering (in either HTML or ASM format) later on.

Whether a particular skool directive or ASM directive is processed depends on the mode in which the parsing is being done: HTML mode or ASM mode.

HTML mode

HTML mode is used when the target output format is HTML (as opposed to ASM). In HTML mode, all skool directives are processed, but most ASM directives are ignored (because they are irrelevant to the purpose of creating the HTML disassemblies). The only ASM directives that are processed in HTML mode are those that introduce two different versions of a section of code or data: one that applies for HTML output, and another that applies for ASM output.

ASM mode

ASM mode is used when the target output format is ASM (as opposed to HTML). In ASM mode, all skool directives and ASM directives are processed.

Rendering

In the second phase, the skool file (stripped of all its skool directives and ASM directives during the parsing phase) is ‘rendered’ - as either HTML or ASM, depending on the mode.

HTML mode

HTML mode is used to render the skool file (and its related ref files) as a bunch of HTML files. During rendering, any skool macros found along the way are expanded to the required HTML markup.

ASM mode

ASM mode is used to render the skool file as a single, assembler-ready ASM file. During rendering, any skool macros found along the way are reduced to some appropriate plain text.

Table Of Contents

Previous topic

Bugs

Next topic

Data files