Conflict resolution in LALR (1) parser

Some conflict questions in LALR (1) analyzers, mainly related to parsing details:

  • According to the various LALR (1) parsers described in the tutorials, if you run into a shift / reduce conflict, then this is the sign by which the grammar is not LALR (1) to begin with, right?

  • Decrease / decrease ends may appear in actual LALR (1) grammars due to the merging of states performed with LR (1) with LALR (1), right?

  • The priority and associativity used in YACC and GNU Bison are tools that help resolve shift / shrink conflicts, right?

  • In addition, associativity should be checked only by the parser, if the priority of conflicting shifts / contractions is equal to the priority of appearance, in any other case, associativity does not matter, right?

I ask because I am not 100% sure and there is no conflict resolution details in the books, only a few lines that I found on this subject in the GNU Bison Handbook

Question related to the above Bison link:

  • Why do they argue that the missing priority in the rules of conflict or is a token, the choice of SHIFT? I would think that if the reduction rule has any advantage, it surpasses the view without any priorities.
+4
1
  • - (/ /) LALR (k), LALR (k).

  • LR (1) LALR (1) /, , , LR (1). / . , LALR (1), LR (1). ( "", .)

  • , ( , ) /.

  • - () (). : & le; < (, %nonassoc, ).

. : "", ; .

: , , ( %prec, , , ) . , . , .

+3

Source: https://habr.com/ru/post/1527546/


All Articles