Class EarleyColumn
Represents a column in the Earley parsing chart, corresponding to a specific position in the input.
Inherited Members
Namespace: EarleyParser
Assembly: EarleyParser.dll
Syntax
public class EarleyColumn
Remarks
Each column maintains the set of all Earley states that have been generated at that position. The column implements the following key components:
-
State Management:
- Predecessors: Dictionary of incomplete states, indexed by their next symbol
- Reductors: Collection of completed states that can be used for completion
- Epsilon state: Special state for handling empty productions
-
Processing Agendas:
- ActionableCompleteStates: Priority queue of completed states to process
- ActionableNonTerminalsToPredict: Queue of non-terminals that need prediction
-
State Addition:
- AddState: Core method that processes new states according to the Earley algorithm
- Handles both incomplete states (adding to predecessors)
- Handles completed states (adding to completion agenda)
The column is a crucial component of the Earley algorithm, maintaining the set of all possible partial parses at each position in the input. It implements the dynamic programming aspect of the algorithm by storing and organizing states efficiently.