Module parol::analysis::k_decision
source · [−]Expand description
Module with conflict calculations
Structs
Cache of FirstSets
Cache of FollowSets
Functions
Calculates maximum lookahead size where max_k is the limit.
Calculates lookahead tuples for all productions, where max_k is the limit.
Calculates lookahead DFAs for all non-terminals, where k is the limit.
Calculates if for a certain non-terminal of grammar cfg the production to
use can be determined deterministically with at maximum max_k lookahead.
To accomplish this, for all productions of the given non-terminal k-tuples
of at most length k are generated, starting with k=1.
If all k-tuples are distinct between all productions the number k is
returned. Otherwise the value of k is incremented by 1 and the process is
retried.
If k_max is exceeded the function returns an error.
Returns conflicts for a given non-terminal at given lookahead size.