alogos._grammar.parsing

Submodules

Functions

read_bnf(grammar, bnf_text, verbose, *symbols)

Read grammar from text in BNF notation.

read_ebnf(grammar, ebnf_text, verbose, *symbols)

Read grammar from text in EBNF notation.

write_bnf(grammar, rules_on_separate_lines, *symbols)

Write grammar as text in BNF notation.

write_ebnf(grammar, rules_on_separate_lines, *symbols)

Write grammar as text in EBNF notation.

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.read_bnf(grammar, bnf_text, verbose, *symbols)[source]

Read grammar from text in BNF notation.

alogos._grammar.parsing.read_ebnf(grammar, ebnf_text, verbose, *symbols)[source]

Read grammar from text in EBNF notation.

References

alogos._grammar.parsing.write_bnf(grammar, rules_on_separate_lines, *symbols)[source]

Write grammar as text in BNF notation.

alogos._grammar.parsing.write_ebnf(grammar, rules_on_separate_lines, *symbols)[source]

Write grammar as text in EBNF notation.

alogos._grammar.parsing.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