alogos._grammar.normalization._shared
¶
Functions¶
Create a terminal that represents the empty string ε. |
|
|
Check if a symbol is a terminal and represents the empty string. |
|
Create a new nonterminal that is not yet part of the grammar. |
|
Repair the grammar after rule modifications so all parts fit. |
Detailed object descriptions¶
- alogos._grammar.normalization._shared.create_empty_terminal()[source]¶
Create a terminal that represents the empty string ε.
- alogos._grammar.normalization._shared.is_empty_terminal(symbol)[source]¶
Check if a symbol is a terminal and represents the empty string.
- alogos._grammar.normalization._shared.create_new_nonterminal(grammar, prefix)[source]¶
Create a new nonterminal that is not yet part of the grammar.
To ensure the nonterminal can be easily recognized as being autogenerated and to ensure that it is a new symbol, a combination of a prefix and an increment is used.
Caution: This function assumes that the grammar’s nonterminal set is up to date with the production rules.
- alogos._grammar.normalization._shared.update_grammar_parts(grammar)[source]¶
Repair the grammar after rule modifications so all parts fit.
Process: - The grammar is reset. - The old production rules are inserted again. - The nonterminals and terminals are deduced from the content
of the production rules.
The start symbol is assumed to be the first nonterminal.