Parser Library

The parser library (in the parser package) implements various parsers that are faster (but weaker) than the compiler's parser. In general, they do not support all functionality of the compiler's parser, and are not as flexible. On the other hand, they are pre-compiled (and have no startup time) and are much faster. They are also able to parse text on any thread, and not locked to the Compiler thread as the compiler's parser.

The limitations and characteristics of the parsers are outlined below. If a parser is fed grammar that is incompatible with the parser, an error is generated at compile-time unless otherwise noted. Another general difference between the compiler's parser and the parsers in this library is that these parsers typically start evaluating transform functions before parsing is complete. As such, some transform functions might be executed even if the string is not in the language described by the grammar.

The following parsers are supported:


The Basic Storm syntax is described below.

To generate a parser, use the following syntax:

<name> : parser(<type>, [binary]) {
    start = <start rule>;

Special Rules

The package parser.special contains a set of special rules. These are special in the sense that some parsers are able to implement them even if they are not possible to express in context-free grammars. See the file syntax.bnf in the parser.special package for more details.

One example of rules that fall into this category are the rules Bytes(Nat) and Chars(Nat). These match a pre-determined number of bytes and codepoints. These are only available in the recursive descent parsers at the moment.

Another example are the rules Indent, MinIndent, and ExactIndent. They can be used to parse indent-sensitive languages (such as markdown). They match the indent specified by the supplied parameters.