I'm using Kenneth Louden's Compiler Construction book but it lacks examples and the rules stating how this goes are really hard to follow. I'm not sure how to go to the LR(1) states. also, not sure how to go from the LR(1) states to the LALR(1) ones.
For example, these LR(1) states:
i understand how the "S -> .XX, $" got there, but then take a look at "X -> .aX, a/b". Why is $ not a part of it? Wasn't it generated from a rule that had $, so doesn't it have to have a $? And how did the a/b appear? According to the book, if A -> alpha.Bgama,a and B is a non-terminal, then B -> .beta, b is added for every B -> beta where b is in first(gamaalpha). So, from what I understood:
S -> .XX, $ and X -> aX and X -> b => X -> aX, $ and X -> b, $
X -> .aX, $ and X -> b, $ => nothing happens
A -> .a, $ => nothing happens
But that seems completely wrong, given the above example.