[Haskell-cafe] GLR parser for Haskell?

Joachim Durchholz jo at durchholz.org
Tue Apr 20 19:15:43 UTC 2021


Am 20.04.21 um 13:12 schrieb Sven Panne:
>     * Does the GLR parser generator detect ambiguities and report them 
> to the grammar writer?

That would be a solution to the decision problem.
It could try heuristics though, but I have no idea whether this 
particular parser does.

 >
  To me, ambiguities (like the shift/reduce &
> reduce/reduce conflicts in LALR parsing) are a big red flag and a sign 
> of a questionable language/grammar: Even if the generator/parser is able 
> to figure things out correctly, humans have a much harder time.

Some conflicts indicate language design problems, others do not.

If you are after an algorithm that has less unnecessary conflicts, try 
ILALR (Sönke Kannapinn's PdD thesis - well-written and easy to 
understand if you can deal with German; see 
http://webdoc.sub.gwdg.de/ebook/diss/2003/tu-berlin/diss/2001/kannapinn_soenke.htm 
; my own analysis, years ago, concluded that ILALR should have its 
conflicts exactly where a human would have difficulties parsing, but I 
never progressed to a proof of concept).

Note that ILALR does does not help with conflict resolution; a user 
would likely have less unexpected conflicts, but the remaining ones 
wouldn't be easier to solve than with LALR.
But I may be wrong. As I said, I never used anything like that in anger.

Regards,
Jo


More information about the Haskell-Cafe mailing list