Skip to content

Reject conflicts in parsing/parser.mly - #598

Merged
gasche merged 5 commits into
ocaml:trunkfrom
yallop:ocamlyacc-conflict-error
Jun 26, 2016
Merged

gasche merged 5 commits into
ocaml:trunkfrom
yallop:ocamlyacc-conflict-error

Conversation

@yallop

@yallop yallop commented May 31, 2016

Copy link
Copy Markdown
Member

In current ocaml trunk the grammar in parsing/parser.mly has a number of reduce/reduce conflicts:

boot/ocamlyacc -v -e parsing/parser.mly
1 rule never reduced
126 reduce/reduce conflicts.

Unfortunately, it's currently quite easy to inadvertently introduce conflicts, since they're not treated as errors.

This pull request

  • adds a new option, -e to ocamlyacc that treats a conflict in a grammar as a fatal error, and
  • updates the Makefile to pass -e when compiling parsing/parser.mly.

Consequently, this PR intentionally breaks the build, which should now fail at the point where the parser is compiled.

@yallop

yallop commented May 31, 2016

Copy link
Copy Markdown
Member Author

Consequently, this PR intentionally breaks the build, which should now fail at the point where the parser is compiled.

#599 fixes the conflicts in the grammar. The combination of that PR and this one restores the build to a working state and adds a check to avoid conflicts in the future.

@Drup

Drup commented May 31, 2016

Copy link
Copy Markdown
Contributor

I think this is a great idea (and I would have been quite happy to have that when I made my parser patches).

I would suggest we adopt menhir's flag for this, which is --strict.

@Octachron

Octachron commented May 31, 2016 •

Copy link
Copy Markdown
Member

As the person who had introduced these reduce/reduce conflicts in the first place, I wholehearteadly agree.

@damiendoligez damiendoligez added this to the 4.04 milestone Jun 7, 2016
@gasche gasche closed this Jun 15, 2016
@gasche gasche reopened this Jun 15, 2016
@mshinwell

Copy link
Copy Markdown
Contributor

@yallop Please change the name of the option to --strict; then this is OK

@damiendoligez

Copy link
Copy Markdown
Member

This PR was discussed last week at the developers meeting, and everyone agreed it's a good idea and the option's name should be --strict. @yallop can you make the change?

@yallop

yallop commented Jun 21, 2016

Copy link
Copy Markdown
Member Author

@damiendoligez: yes, I'll push the change shortly.

@yallop

yallop commented Jun 22, 2016

Copy link
Copy Markdown
Member Author

@gasche
gasche merged commit bd9693b into ocaml:trunk Jun 26, 2016
@yallop
yallop deleted the ocamlyacc-conflict-error branch June 27, 2016 06:53
@yallop

yallop commented Jun 27, 2016

Copy link
Copy Markdown
Member Author

Thanks, @gasche. I just realised that I didn't add a Changelog entry, which might be helpful since this is a change in the ocamlyacc interface. Would you like another PR to add the entry, or can you push small changes like that directly?

@gasche

gasche commented Jun 27, 2016

Copy link
Copy Markdown
Member

I pushed a Changes entry. Thanks!

camlspotter pushed a commit to camlspotter/ocaml that referenced this pull request Oct 17, 2017
stedolan pushed a commit to stedolan/ocaml that referenced this pull request May 24, 2022
EmileTrotignon pushed a commit to EmileTrotignon/ocaml that referenced this pull request Jan 12, 2024
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

Successfully merging this pull request may close these issues.

6 participants