Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Algorithms
  4. LALR vs LR parsing

LALR vs LR parsing

Scheduled Pinned Locked Moved Algorithms
questionvisual-studiojson
4 Posts 2 Posters 17 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • honey the codewitchH Offline
    honey the codewitchH Offline
    honey the codewitch
    wrote on last edited by
    #1

    Okay, so I know the table generation algorithms are slightly different in that LALR merges entries and a canonical LR parser will not. My question is, is about the actual *use* of those entries - the final parse table. Is there a difference between how a LALR parser parses and an LR parser *parses*? Specifically, can I use the same parser code regardless of where I got the parse table? (whether from an LR algo or the LALR ago)

    Real programmers use butterflies

    M 1 Reply Last reply
    0
    • honey the codewitchH honey the codewitch

      Okay, so I know the table generation algorithms are slightly different in that LALR merges entries and a canonical LR parser will not. My question is, is about the actual *use* of those entries - the final parse table. Is there a difference between how a LALR parser parses and an LR parser *parses*? Specifically, can I use the same parser code regardless of where I got the parse table? (whether from an LR algo or the LALR ago)

      Real programmers use butterflies

      M Offline
      M Offline
      Member 12982558
      wrote on last edited by
      #2

      shift/reduce parsing: the difference between LALR (1) and LR (1) is that LALR is based on an LR (0) automaton. Operationally they are the same: shift when you have to shift, reduce when you have to reduce and give an error message when there is a mismatch between the set of expected tokens and the received token

      honey the codewitchH 2 Replies Last reply
      0
      • M Member 12982558

        shift/reduce parsing: the difference between LALR (1) and LR (1) is that LALR is based on an LR (0) automaton. Operationally they are the same: shift when you have to shift, reduce when you have to reduce and give an error message when there is a mismatch between the set of expected tokens and the received token

        honey the codewitchH Offline
        honey the codewitchH Offline
        honey the codewitch
        wrote on last edited by
        #3

        It's based on it, but it still has partial look ahead so I'd same it's somewhere between LR(0) and LR(1) But then maybe that's arguing semantics, i don't know but that's how I see it. In expressive power it bakes out that way anyway. And I use it that way because LALR(1) is not referred to as LALR(0). Same with SLR(1) - which i don't think anyone uses because there's little point, but academically i mean.

        Real programmers use butterflies

        1 Reply Last reply
        0
        • M Member 12982558

          shift/reduce parsing: the difference between LALR (1) and LR (1) is that LALR is based on an LR (0) automaton. Operationally they are the same: shift when you have to shift, reduce when you have to reduce and give an error message when there is a mismatch between the set of expected tokens and the received token

          honey the codewitchH Offline
          honey the codewitchH Offline
          honey the codewitch
          wrote on last edited by
          #4

          anyway thanks for your answer, i figured it out eventually the day i asked it but i didn't think to close the question (and i don't know if that's expected)

          Real programmers use butterflies

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups