Skip to content

Example that bison/yacc reports reduce/reduce conflict but lalr doesn't #52

@mingodad

Description

@mingodad

From the bison manual https://www.gnu.org/software/bison/manual/bison.html#Mysterious-Conflicts lalr doesn't report any conflict.

mysterious_reduce_reduce {
%whitespace "[ \t\r\n]*" ;

def: param_spec return_spec ',';
param_spec:
  type
| name_list ':' type
;

return_spec:
  type
| name ':' type
;

type: 'id';

name: 'id';
name_list:
  name
| name ',' name_list
;
}

input:

id id

Playground lexer dump:

=line:column:type:index:identifier:lexeme:value
1:1:1:10:[name]:[id]:[id]
1:4:1:10:[name]:[id]:[id]
1:6:1:7:[comma_terminal]:[,]:[,]
=line:column:type:index:identifier:lexeme:value
1:1:1:10:[name]:[id]:[id]
1:4:1:10:[name]:[id]:[id]
1:6:1:7:[comma_terminal]:[,]:[,]

Playground parse tree:

def
 |param_spec
 | |name -> id
 |return_spec
 | |name -> id
 |comma_terminal -> ,

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions