Questions tagged [reduce-reduce-conflict]

50 questions
7
votes
0 answers

Happy: Order of Productions Removes R/R Conflicts

I have a grammar that, depending on the order of productions, happy reports 3 reduce/reduce conflicts or none. The minimal example I can find is: %tokentype {Token} %token int { Int } '-' { Neg } both { Both } %nonassoc…
sfogarty
  • 71
  • 1
6
votes
1 answer

Shift reduce and reduce reduce conflicts

I'm having a hard time wrapping my head around this and need some help understanding shift reduce and reduce reduce conflicts. I have a grammar which I can't seem to understand why it's problematic. I could attach the grammar, but I want to learn…
John Leidegren
  • 59,920
  • 20
  • 131
  • 152
3
votes
1 answer

Bison reduce/reduce

I am new to Bison parsing and I cannot understand how it works. I have the following grammar, where I have kept the bare minimum to highlight the problem. %left '~' %left '+' %token T_VARIABLE %% start: expr; expr: composite_expr |…
linepogl
  • 9,147
  • 4
  • 34
  • 45
3
votes
2 answers

Resolving reduce/reduce conflicts

We have a CFG grammar and we construct LR(1) Parsing Table. We see that one cell on the parsing table have a reduce - reduce conflict. Is it possible to solve this conflict by using more input symbols of lookahead at each step? I am asking this…
3
votes
1 answer

Simple ambiguous grammar with reduce-reduce conflict

The following simple grammar to parse a logical expression results in a reduce/reduce conflict: %token AND OR %token NUMBER VARIABLE %% logical_expr : logical_expr AND logical_term | logical_expr OR logical_term | logical_term …
3
votes
1 answer

happy: reduce/reduce conflict

Why this raises a warning about reduce/reduce conflict root : set1 'X' | set2 'X' 'X' set1 : 'A' | 'B' set2 : 'B' | 'C' but the next is ok? root : 'A' 'X' | 'B' 'X' | 'B'…
user1374768
  • 288
  • 2
  • 11
2
votes
1 answer

Bison reduce/reduce conflict between lambda expression and parenthesized identifier

I'm attempting to write my own programming language at the moment, and I have the following simplified grammar: ... %% prog: stmtlist | %empty; block: "{" stmtlist "}"; stmtlist: stmtlist ";" stmt | stmt; decllist: decllist "," decl |…
jinscoe123
  • 1,467
  • 14
  • 24
2
votes
4 answers

bison shift instead of reduce. With reduce/reduce errors

In my language i can write a = 1 b = 2 if true { } else { } if true { } **Here is the problem** else {} My grammer doesnt support newlines between statements. An else can only be used with an if. When i add optionalNL in my rule IfExpr: IF rval…
user34537
1
vote
1 answer

YACC grammar reduce/reduce conflict

I have the following grammar for checking the validity of an XML file, the file starts with an element and then the root node. program : terminal_node root ; root : '<' ID attribute_list '>' node_list '<' ID '/''>' ; node_list …
mihajlv
  • 2,275
  • 4
  • 36
  • 59
1
vote
0 answers

Can the grammar of the concatenation of two lists with common elements be written as an LALR grammar without any collisions

Can the following ABNF rules be written as a bison LALR grammar without any conflicts (shift/reduce or reduce/reduce)? Among them, lowercase letters are non-terminal symbols, and uppercase letters are terminal symbols. s = [*(A / D) D] *(A / B) The…
1
vote
2 answers

How do i tell bison there is a syntax error?

What happen is there is a specific case where after analyzing the AST i will know if there is an error or not when the rule is finished. I tried yyerror("blah") with no luck. Because i cant tell it there is an error it finishes another rule and now…
user34537
1
vote
0 answers

Reduce/reduce conflicts

I'm trying to create a parser for a simple language, but I can't get rid of some reduce/reduce conflicts because of the rules expr: l_value and r_value: '@' l_value. I tried to fix it determining a precedence for the symbol '@' but it didn't help. A…
1
vote
1 answer

LR(1) Parser: Why adding an epsilon production makes r/r or s/r conflicts

I wanted to make a reader which reads configuration files similar to INI files for mswin. It is for exercise to teach myself using a lexer/parser generator which I made. The grammar is: %lexer HEADER ::= "\\[[0-9a-zA-Z]+\\]" TRUE ::=…
Felix.leg
  • 622
  • 1
  • 4
  • 13
1
vote
1 answer

How to resolve this reduce/reduce conflict?

I am writing a compiler for the B programming language. The grammar of this language distinguishes lvalues and rvalues syntactically. While translating the grammar into yacc syntax, I stumbled upon a reduce/reduce conflict. Here is a minimal,…
fuz
  • 88,405
  • 25
  • 200
  • 352
1
vote
0 answers

Redux state is not updated Issue. But redux logger shows the correct action and next state update

I am using Redux for my web application. State has to be updated after user login. Redux logger is used for debugging. Everything is fine in redux logger but state is not updated. Please give any idea about this issue. Reducers: import {…
1
2 3 4