Groups | Search | Server Info | Login | Register
Groups > comp.compilers > #3716
| From | Richard Rogers <rprogers@seanet.com> |
|---|---|
| Newsgroups | comp.compilers |
| Subject | LALR look-ahead sets from item right context grammar? |
| Date | 2026-02-07 01:42 +0000 |
| Organization | Compilers Central |
| Message-ID | <26-02-004@comp.compilers> (permalink) |
The right context grammar for item i in state j of the LR(0) automaton of CFG G describes allĀ of the suffixes that can follow any prefix arriving at (i, j) when parsing a string in L(G). If the start symbol of the right context grammar is nullable, it would mean a string in L(G) could end at (i, j). If we augment G with S' -> S $ then S' -> S $ * should be the only item with a nullable right context grammar start symbol, and FOLLOW would also be the empty string. And my hypothesis is that FIRST(RCG(i,j)) is the LALR look-ahead set for (i, j), where RCG(i, j) is the start symbol of the right context grammar for item i in state j of the LR(0) automaton of the augmented G. The RCG computing algorithm gives a right-regular grammar for the right contexts if the non-terminals of G are treated as terminals in the RCG. For making an LR-Regular parser, G's non-terminals are replaced by their approximate regular envelopes to give a regular approximation of the right contexts. But if we include G's non-terminals and productions in the RCG, the RCG is an accurate CFG for the right contexts.
Back to comp.compilers | Previous | Next — Next in thread | Find similar
LALR look-ahead sets from item right context grammar? Richard Rogers <rprogers@seanet.com> - 2026-02-07 01:42 +0000 LALR look-ahead sets from item right context grammar? Richard Rogers <rprogers@seanet.com> - 2026-02-28 13:43 +0000
csiph-web