Table of Contents

Class: ruleset Zope-2.2.1-src/lib/python/Products/ZGadflyDA/gadfly/kjParseBuild.py

Ruleset class, used to compute NFA and then DFA for parsing based on a list of rules.

Methods   
CompDFA
CompFirst
CompFollow
CompSLRNFA
DoSLRGeneration
DumpDFAsets
DumpFirstFollow
DumpItemSet
DumpSLRNFA
FirstOfTail
ItemDump
SLRFixDFA
SLRItemIsFinal
__init__
  CompDFA 
CompDFA ( self )

compute DFA for ruleset by computing the E-closure of the NFA

  CompFirst 
CompFirst ( self )

method to compute prefixes and First sets for nonterminals

Exceptions   
TokenError
  CompFollow 
CompFollow ( self )

computing the Follow set for the ruleset the good news: I think it's correct. the bad news: It's slower than it needs to be for epsilon cases.

Exceptions   
TokenError
  CompSLRNFA 
CompSLRNFA ( self )

compute an SLR NFA for the ruleset with states for each SLR "item" and transitions, eg: X > .AB on A maps to X > A.B on epsilon maps to A > .ZC and A > .WK an item is a pair (rulenumber, bodyposition) where body position 0 is interpreted to point before the beginning of the body.

SLR = "simple LR" in Aho+Ullman terminology

Exceptions   
NotSLRError
  DoSLRGeneration 
DoSLRGeneration ( self )

do complete SLR DFA creation starting after initialization

  DumpDFAsets 
DumpDFAsets ( self )

  DumpFirstFollow 
DumpFirstFollow ( self )

  DumpItemSet 
DumpItemSet ( self,  State )

  DumpSLRNFA 
DumpSLRNFA ( self )

dump the NFA

  FirstOfTail 
FirstOfTail (
        self,
        Rule,
        TailIndex,
        Token=None,
        )

computing the "first" of the tail of a rule followed by an optional terminal doesn't include NULLTOKEN requires self.First to be computed

Exceptions   
TokenError
  ItemDump 
ItemDump ( self,  item )

dump an item

  SLRFixDFA 
SLRFixDFA ( self )

this function completes the computation of an SLR DFA by adding reduction states for each DFA state S containing item H > B. which reduces rule H > B for each token T in Follow of H. if S already has a transition for T then there is a conflict!

assumes DFA and SLRNFA and Follow have been computed.

Exceptions   
NotSLRError
  SLRItemIsFinal 
SLRItemIsFinal ( self,  item )

utility function

returns true if an item is a final item

  __init__ 
__init__ (
        self,
        StartNonterm,
        Rulelist,
        )


Table of Contents

This document was automatically generated on Mon Sep 4 07:33:06 2000 by HappyDoc version r0_6