I'm learning natural language processing and I can't understand the difference between Shift-Reduce parser and LR parser.

As I've understood from Wikipedia, shift-reduce is just a name of a class of parsing algorithms which includes LR, LALR, SLR and other. But some articles describe algorithm of shift-reduce parsing like it is a separate algorithm. So what is the difference between algorithm of shift-reduce parsing and algorithm of LR parsing?

  • 2
    $\begingroup$ 1/ Never assume a definition is universally accepted, people tend to adapt them for their purpose. 2/ I don't see how you deduce from that set of slides -- which by nature are terse and a support for a presentation which often give information needed to understand them -- that the authors are not considering shift reduce as a class of algorithm of which LR is a member (slide 22 for instance seem to characterize LR as a table-driven shift reduce algorithm). $\endgroup$ – AProgrammer Jan 5 '17 at 7:52
  • $\begingroup$ @AProgrammer So the difference lies in the fact that LR is table-driven, and shift-reduce uses logic statements? $\endgroup$ – Amir Jan 5 '17 at 11:08
  • 3
    $\begingroup$ For me, shift-reduce is a class of algorithms, LR is a member of that class, the fact that it happens to use a table is not a very important characteristic (table are just a convenient way in general to describe a function and for LR how it is determined). Asking the difference between shift-reduce and LR is like asking the difference between a car and a Ferrari, and stating that the difference is that LR is table-driven while shift-reduce is uses logic statements is like stating that the Ferrari is red while a car is colored. $\endgroup$ – AProgrammer Jan 5 '17 at 13:09
  • $\begingroup$ @AProgrammer Thank you for clear explanation! $\endgroup$ – Amir Jan 5 '17 at 16:50
  • 2
    $\begingroup$ @AProgrammer How about answering the question? $\endgroup$ – André Souza Lemos Jan 5 '17 at 17:44

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.