Simple LR Parser
In computer science, a Simple LR or SLR parser is a type of LR parser with small parse tables and a relatively simple parser generator algorithm. As with other types of LR(1) parser, an SLR parser is quite efficient at finding the single correct bottom-up parse in a single left-to-right scan over the input stream, without guesswork or backtracking. The parser is mechanically generated from a formal grammar for the language.
SLR and the more-general methods LALR parser and Canonical LR parser have identical methods and similar tables at parse time; they differ only in the mathematical grammar analysis algorithms used by the parser generator tool. SLR and LALR generators create tables of identical size and identical parser states. SLR generators accept fewer grammars than do LALR generators like yacc and Bison. Many computer languages don't readily fit the restrictions of SLR, as is. Bending the language's natural grammar into SLR grammar form requires more compromises and grammar hackery. So LALR generators have become much more widely used than SLR generators, despite being somewhat more complicated tools. SLR methods remain a useful learning step in college classes on compiler theory.
SLR and LALR were both developed by Frank DeRemer as the first practical uses of Donald Knuth's LR parser theory. The tables created for real grammars by full LR methods were impractically large, larger than most computer memories of that decade, with 100 times or more parser states than the SLR and LALR methods.
Read more about Simple LR Parser: Lookahead Sets, Example
Famous quotes containing the word simple:
“The prostitute is the scapegoat for everyones sins, and few people care whether she is justly treated or not. Good people have spent thousands of pounds in efforts to reform her, poets have written about her, essayists and orators have made her the subject of some of their most striking rhetoric; perhaps no class of people has been so much abused, and alternatively sentimentalized over as prostitutes have been but one thing they have never yet had, and that is simple legal justice.”
—Alison Neilans. Justice for the ProstituteLady Astors Bill, Equal Rights (September 19, 1925)