Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
mingodad opened this issue Jul 20, 2023 · 0 comments
Open

Comments

@mingodad
Copy link
Contributor

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 -> ,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant