I'm trying to understand how LR1 parsers work, but I've come up with a strange problem: What if apocalon occurs in grammar? For example: If I have grammar:
S -> AA - & gt; A.A. BB - & gt; A
This is how it starts:
S -> AA - & gt; . AA - & gt; .
... and so on
But I do not know how to do this kind of grammar:
s - & gt; AA - & gt; Aaa \ Epsilon
Is it OK to do this:
S -> AA - & gt; . AAA (A ->. \ Epsilon)
And then should the state accept it in DFA?
Any help would be appreciated!
Yes, of course (think Epicelon is empty space, where there are no two places for the dot on the sides Are).
In an LR (0) autoton, you accept the state and reduce the A. However, the A-> AA
output, there will be a change / conflict reduced.
In an LR (1) automaton, you can determine or decrease
Comments
Post a Comment