This page will explain how to go from a Katydid grammar to validating a parsed tree. This is done in two steps. Each of these steps have several alternatives.
This assumes you have already constructed a parser, if not see the page on parser usage.
First we need to parse our relapse string into a grammar. This is perfect for when we are receiving a string from the user or a configuration file.
If you don’t understand the katydidString’s value it might be good idea to first take the Katydid Tour.
We could also have programmatically constructed our ast (abstract syntax tree).
This can become quite verbose, so we can rather use the combinator library, with which we can more concisely, but still programmatically, construct the grammar.
We can also use combinator functions on the leaves.
Now that we have an initialized parser and a katydid grammar we can validate the parsed tree against the schema.
Here we created a memoized grammar for faster repeated execution, which is the default way to use Katydid, but there are others way too that we won't cover here.