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

Class SLRtable

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)
Method Summary
  closure(self, items)
The closure of a set of LR(0) items I is the set of items construted from I by the two rules:
  dotatend(self, item, i)
  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 in I
  items(self)
An LR(0) item of a grammar G is a production of G with a dot at some position of the right hand side.
  NextToDot(self, item)
returns symbol next to te dot or empty string
    Inherited from LRtable
  __init__(self, cfgr, operators, noconflicts, expect)
  add_action(self, i, a, action, j)
Set (action,j) for state i and symbol a or raise conflict error.
  make_action_goto(self)
make action[i,X] and goto[i,X] All pairs (i,s) not in action and goto dictionaries are 'error'
  resolve_shift_reduce(self, i, a, s, r)
Operators precedence resolution or standard option: shift
  rules_precedence(self)
Rule precedence obtained as the precedende of the right most terminal.

Instance Variable Summary
    Inherited from LRtable
  gr: a context-free grammar
  Log: Log report for LR table construction
  operators: operators

Method Details

closure(self, items)

The closure of a set of LR(0) items I is the set of items construted 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)

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 in I

items(self)

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

NextToDot(self, item)

returns symbol next to te dot or empty string

Generated by Epydoc 2.0 on Sun Nov 16 11:16:30 2003 http://epydoc.sf.net