alogos._grammar.parsing.parsing_with_lark

Functions

parse_string(grammar, string, parser, get_multiple_trees, max_num_trees=None)

Parse a string with Lark and construct a derivation tree of this package.


Detailed object descriptions

alogos._grammar.parsing.parsing_with_lark.parse_string(grammar, string, parser, get_multiple_trees, max_num_trees=None)[source]

Parse a string with Lark and construct a derivation tree of this package.

The derivation tree is built with the data structure defined in this package, not with the parse tree object provided by Lark. The reason is that the derivation tree is subsequently used for various tasks such as different traversals, extracting strings or derivations and visualization. Therefore it desirable to have it decoupled from the parser library and that it comes with methods for the mentioned tasks.

References