Mentions légales du service

Skip to content

Update SDK to preserve backward compatibility

BOUR Frederic requested to merge fbour/menhir:backward-compat into master

This patch restores the signature of Lr1.reductions in MenhirSDK.

Known users are:

  • Merlin
  • OCamlformat (though the related code is being removed, the dependency should disappear in the next major version)
  • maybe some code of Marigold/Ligo (at some point they were using MenhirSDK, I don't know what is the current state)

Lr1.reductions has signature state -> (terminal * production list) list, though it should really be (terminal * production list) list since the list of productions should always be a singleton.

(The original intent was to save all the transitions of the automaton before conflict resolution, but in practice this has never been the case since the first public release: the automaton is captured after conflict resolution and there can be at most one action per lookahead).

In the future, it would be nice to cleanup the signature. But I am not sure how to handle the transition smoothly.

  1. Add a new function with the correct signature. That's what the second path does with Lr1.get_reductions. Though this is not really satisfying, I would prefer to cleanup the API before it has more users, e.g. LRgrep.

  2. Wait for OCamlformat cleanup to be released. Check with Marigold/Ligo if they can handle the transition on their side. We (Tarides) will do the same on our side with Merlin. Then it should be possible to release a version of Menhir with the new API.

If we go for the second option, the second patch for this MR should be ignored.

Sorry for the inconvenience.

Edited by BOUR Frederic

Merge request reports