I am trying to implement the Warshall algorithm to quickly calculate LR (1) closures.
I think I understand how this works for LR (0):
- Graph nodes LR elements , for example
A β B β’ C - Edges are βtransitions,β starting from
A β B β’ C to C β β’ D
The problem is that LR (1) requires the calculation of lookaheads, and I cannot figure out how to include them in the algorithm.
It seems to me that even if I know the transitive closure of any given LR element, I still need to go through all the same calculations to find out what for each element has the form.
Is it possible to use the Warshall algorithm to calculate the canonical closures of LR (1), or is this only possible for more limited cases (for example, LR (0), SLR (1), etc.)?
source share