Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
LALR parser
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Overview == Generally, the LALR parser refers to the LALR(1) parser,{{efn|"LALR(1)" is pronounced as the [[initialism]] "el-ay-el-arr-one"}} just as the LR parser generally refers to the LR(1) parser. The "(1)" denotes one-token lookahead, to resolve differences between rule patterns during parsing. Similarly, there is an LALR(2) parser with two-token lookahead, and LALR(''k'') parsers with ''k''-token lookup, but these are rare in actual use. The LALR parser is based on the LR(0) parser, so it can also be denoted LALR(1) = LA(1)LR(0) (1 token of lookahead, LR(0)) or more generally LALR(''k'') = LA(''k'')LR(0) (k tokens of lookahead, LR(0)). There is in fact a two-parameter family of LA(''k'')LR(''j'') parsers for all combinations of ''j'' and ''k'', which can be derived from the LR(''j'' + ''k'') parser,<ref>''Parsing Techniques: A Practical Guide,'' by Dick Grune and Ceriel J. H. Jacobs, "9.7 LALR(1)", [https://books.google.com/books?id=05xA_d5dSwAC&pg=PA302 p. 302]</ref> but these do not see practical use. As with other types of LR parsers, an LALR parser is quite efficient at finding the single correct [[bottom-up parsing|bottom-up parse]] in a single left-to-right scan over the input stream, because it does not need to use [[backtracking]]. Being a lookahead parser by definition, it always uses a lookahead, with {{nowrap|LALR(1)}} being the most-common case.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)