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
Canonical LR 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!
=== Creating new item sets === The rest of the item sets can be created by the following algorithm : 1. For each terminal and nonterminal symbol A appearing after a 'β’' in each already existing item set k, create a new item set m by adding to m all the rules of k where 'β’' is followed by A, but only if m will not be the same as an already existing item set after step 3. : 2. shift all the 'β’'s for each rule in the new item set one symbol to the right : 3. create the closure of the new item set : 4. Repeat from step 1 for all newly created item sets, until no more new sets appear In the example we get 5 more sets from item set 0, item set 1 for nonterminal E, item set 2 for nonterminal T, item set 3 for terminal n, item set 4 for terminal '+' and item set 5 for '('. Item set 1 (E): : [S β E β’, $] Item set 2 (T): : [E β T β’, $] : [T β T β’ + n, $] : [T β T β’ + n, +] : Β· : Β· : Β· Item set 3 (n): : [T β n β’, $] : [T β n β’, +] : [T β n β’, )] Item set 4 ('+'): : [T β + β’ T, $] : [T β + β’ T, +] : [T β β’ n, $] : [T β β’ n, +] : [T β β’ + T, $] : [T β β’ + T, +] : [T β β’ T + n, $] : [T β β’ T + n, +] : Β· : Β· : Β· Item set 5 ('('): : [E β ( β’ E ), $] : [E β β’ T, )] : [E β β’ ( E ), )] : [T β β’ n, )] : [T β β’ n, +] : [T β β’ + T, )] : [T β β’ + T, +] : [T β β’ T + n, )] : [T β β’ T + n, +] : Β· : Β· : Β· From item sets 2, 4 and 5 several more item sets will be produced. The complete list is quite long and thus will not be stated here. Detailed LR(k) treatment of this grammar can e.g. be found in [http://david.tribble.com/text/lrk_parsing.html].
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)