parsing_table
LR0ParsingTable
Table that contains all the transitions from state to state with a symbol.
Source code in src/syntactes/parsing_table/table.py
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 | |
grammar
property
The grammar the table was created for.
initial_state
property
The state the parser starts from, i.e. the state with number 1.
Raises ValueError if the table has no entries from that state.
add_entry(entry)
Adds an entry to the parsing table.
Source code in src/syntactes/parsing_table/table.py
conflicts()
Retuns a list with all the conflicts in the parsing table.
Source code in src/syntactes/parsing_table/table.py
from_entries(entries, grammar)
classmethod
Create a parsing table from the given entries.
get(state)
Get the mapping of tokens to actions for the given state number. Returns None if the state is not found.
get_actions(state, token)
Get the actions from state with given number with token.
If there are no actions, returns None.
Source code in src/syntactes/parsing_table/table.py
pretty_str()
Returns a pretty-formatted string representation of the table.
LR1ParsingTable
Bases: LR0ParsingTable
Table that contains all the transitions from state to state with a symbol.
Source code in src/syntactes/parsing_table/table.py
ParsingTable
Bases: Protocol
The interface of the parsing tables that generators create and parsers use.
Source code in src/syntactes/parsing_table/table.py
SLRParsingTable
Bases: LR0ParsingTable
Table that contains all the transitions from state to state with a symbol.
Source code in src/syntactes/parsing_table/table.py
Entry
An entry of the parsing table. Holds the information of a transition from a state to another state via a symbol.
Source code in src/syntactes/parsing_table/entry.py
Conflict
A cell of a parsing table with more than one action: the actions for
token in state.
Source code in src/syntactes/parsing_table/conflict.py
conflict_type
property
The kind of the conflict, from the types of its actions.
pretty_str()
Returns a pretty-formatted string with conflict details.
Source code in src/syntactes/parsing_table/conflict.py
ConflictType
Bases: Enum
The kinds of actions that conflict in a cell of a parsing table.