Parser

The parser library allows pre-compiling grammar into a specialized parser. This is a useful complement to the parser used by the compiler for several reasons:

The parser library addresses these shortcomings by allowing grammar to be pre-compiled, and then executed as regular Storm functions. The grammar may still be specified using the regular syntax language, and can thus be re-used between the system parser and parsers from the parser library.

This library is usable as a syntax extension to Basic Storm as follows:

myParser : parser(recursive descent) {
    start = Rule;
    // ...
}

This creates a parser function, myParser that parses the specified language. Grammar can be declared inside the brackets or in other .bnf files as usual. Multiple parsers are supported by the syntax, but currently only recursive descent parsers are implemented.

For more details, see the documentation for the parser package (either help parser or look in the file root/parser/README).