Module parser :: Class SLRtable
[hide private]
[frames] | no frames]

Class SLRtable

source code

LRtable --+
          |
         SLRtable

Class for construction of a SLR table

SLR items represented by a pair of integers (number of rule,position of dot)

(aho86:_compil page 221)

Instance Methods [hide private]
 
dotatend(self, item, i) source code
 
closure(self, items)
The closure of a set of LR(0) items I is the set of items constructed from I by the two rules:
source code
 
goto(self, items, s)
goto(I,X) where I is a set of items and X a grammar symbol is the closure of the set of all items A -> sX.r such that A -> s.Xr is in I
source code
 
items(self)
An LR(0) item of a grammar G is a production of G with a dot at some position on the right hand side.
source code
 
print_items(self, c)
Print SLR items
source code
 
NextToDot(self, item)
returns symbol next to te dot or empty string
source code

Inherited from LRtable: __init__, add_action, make_action_goto, resolve_shift_reduce, rules_precedence

Instance Variables [hide private]

Inherited from LRtable: Log, gr, operators

Method Details [hide private]

closure(self, items)

source code 

The closure of a set of LR(0) items I is the set of items constructed from I by the two rules:

  • every item of I is in closure(I)
  • If A -> s.Bt in closure(I) and B -> r, then add B ->.r to closure(I)

(aho86:_compil page 223)

items(self)

source code 

An LR(0) item of a grammar G is a production of G with a dot at some position on the right hand side. It is represented by the rule number and the position of the dot

Returns:
a set of sets of items