A basic vector-driven parser generator.
A basic vector-driven parser generator.
(create-parser tree)Create a parser based on a vector-driven combinator tree. For example:
{:foobar [:chain [:ref :foo] [:ref :bar]]
:foo [:literal "foo"]
:bar [:with-name :bax
[:choice [:literal "bar"]
[:literal "baz"]]]}
Each vector is expanded into the combinator invocation, referenced
by the first keyword. If the keyword does not have a namespace,
crustimoney.combinators is assumed. Maps are walked as well,
wrapped in crustimoney.combinators/grammar. Other data is left
as-is.
This type of parser generator is not intended to be used directly, though you can. It is used as an intermediary format for other formats, such as the string-based and data-based grammars.
Create a parser based on a vector-driven combinator tree. For
example:
{:foobar [:chain [:ref :foo] [:ref :bar]]
:foo [:literal "foo"]
:bar [:with-name :bax
[:choice [:literal "bar"]
[:literal "baz"]]]}
Each vector is expanded into the combinator invocation, referenced
by the first keyword. If the keyword does not have a namespace,
`crustimoney.combinators` is assumed. Maps are walked as well,
wrapped in `crustimoney.combinators/grammar`. Other data is left
as-is.
This type of parser generator is not intended to be used directly,
though you can. It is used as an intermediary format for other
formats, such as the string-based and data-based grammars.cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |