Logo Search packages:      
Sourcecode: gadfly version File versions  Download package

def gadfly::kjParseBuild::CGrammar::Compile (   self,
  MetaGrammar = RULEGRAM 
)

The compilation function assumes
      NonTermDict
      RuleString
      LexD
      TermDict
    have all been set up properly
    (at least if the default MetaGrammar is used).
    On successful completion it will set up
      DFA
      RuleL
      RuleNameToIndex

    the following should return a list of rules
    with punctuations of self.LexD interpreted as trivial keywords
      keywords of seld.LexD interpreted as keywords
    and nonterminals registered in NonTermDict interpreted as
    nonterms.
     ParseResult should be of form ( (rootNT, RuleL), self )

Definition at line 809 of file kjParseBuild.py.

00809                                            :
        ''' The compilation function assumes
              NonTermDict
              RuleString
              LexD
              TermDict
            have all been set up properly
            (at least if the default MetaGrammar is used).
            On successful completion it will set up
              DFA
              RuleL
              RuleNameToIndex

            the following should return a list of rules
            with punctuations of self.LexD interpreted as trivial keywords
              keywords of seld.LexD interpreted as keywords
            and nonterminals registered in NonTermDict interpreted as
            nonterms.
             ParseResult should be of form ( (rootNT, RuleL), self )
        '''
        ParseResult = MetaGrammar.DoParse1( self.RuleString, self )
        (RootNonterm, Rulelist) = ParseResult

        # make a ruleset and compute its DFA
        RuleS = Ruleset( RootNonterm, Rulelist )
        RuleS.DoSLRGeneration()

        # make the rulename to index map to allow future bindings
        for i in range(0,len(Rulelist)):
            Rule = Rulelist[i]
            self.RuleNameToIndex[ Rule.Name ] = i

        # fill in the blanks
        self.DFA = RuleS.DFA
        self.RuleL = Rulelist

        # FOR DEBUG AND TESTING
        self.Ruleset = RuleS

        # DON'T clean up the grammar (misc structures are used)
        # in future bindings
    #enddef Compile

    def Reconstruct(self, VarName, Tofile, FName=None, indent=""):


Generated by  Doxygen 1.6.0   Back to index