https://en.wikipedia.org/wiki/LALR_parser - as far as I understand, LALR(1) is a simplified version of LR(1), aiming to achieve a greater parsing performance at the expense of reduced power. So, IIUC, LALR(1) is a strict subset of LR(1): each grammar parseable by LALR(1) is parseable by LR(1), but not the other way around.

I'm surprised because it seems I've managed to create a grammar for which this tool: https://mdaines.github.io/grammophone/ says it is not LR(1) but is LALR(1) .

Therefore: Am I mistaken in my belief that LALR(1) is a strict subset of LR(1)? Or is Grammophone buggy and unreliable?

  • 2
    $\begingroup$ "I've managed to create a grammar." Can you include your grammar in the question? $\endgroup$ – John L. Apr 24 '19 at 17:32
  • $\begingroup$ @Apass.Jack Sadly, nope. $\endgroup$ – gaazkam Apr 24 '19 at 17:33
  • $\begingroup$ Grammophone is unreliable, sadly. Bison has a canonical-lr mode, which is reliable afaik. $\endgroup$ – rici Apr 24 '19 at 19:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.