Home | Trees | Index | Help |
|
---|
Package lemon :: Package external :: Package gadfly :: Module kjParseBuild :: Class CGrammar |
|
Grammar
--+
|
CGrammar
a derived grammar class this is a compilable grammar for automatic parser generation.
Method Summary | |
---|---|
register a list of regular expression strings... | |
The compilation function assumes NonTermDict RuleString LexD TermDict have all been set up properly (at least if the default MetaGrammar is used). | |
initialize or add more rules to the RuleString... | |
insert a white separated list of keywords into the LexD TODO: THIS SHOULD CHECK FOR KEYWORD/NONTERMINAL/PUNCT NAME COLLISIONS (BUT DOESN'T YET). | |
marshalling of a grammar to a file... | |
register a white separated list of nonterminal strings... | |
insert a string of punctuations into the LexD... | |
Write a reconstructable representation for this grammar to a file... | |
Inherited from Grammar | |
| |
this method associates rules to names using a RuleNameDict dictionary which maps names to rule indices. | |
bind a terminal to a regular expression and interp function... | |
if the Name dictionary has been initialized... | |
this may be silly, but to save some space in construction a token dictionary may be used that facilitates sharing of token representations. | |
parse a string using the grammar, return result and context... | |
parse a string using the grammar, but only return... | |
look for default bindings... | |
setting case sensitivity: must happen before keyword installation in LexD. |
Method Details |
---|
comments(self, listOfCommentStrings)register a list of regular expression strings to represent comments in LexD |
Compile(self, MetaGrammar=<lemon.external.gadfly.kjParser.Grammar instance at 0x016...)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 ) |
Declarerules(self, StringWithRules)initialize or add more rules to the RuleString |
Keywords(self, Stringofkeys)insert a white separated list of keywords into the LexD TODO: THIS SHOULD CHECK FOR KEYWORD/NONTERMINAL/PUNCT NAME COLLISIONS (BUT DOESN'T YET). |
MarshalDump(self, Tofile)marshalling of a grammar to a file |
Nonterms(self, StringofNonterms)register a white separated list of nonterminal strings |
punct(self, Stringofpuncts)insert a string of punctuations into the LexD |
Reconstruct(self, VarName, Tofile, FName=None, indent='')Write a reconstructable representation for this grammar to a file EXCEPT: - rule associations to reduction functions will be lost (must be reset elsewhere) - terminals in the lexical dictionary will not be initialized IND is used for indentation, should be whitespace (add check!) FName if given will cause the reconstructed to be placed inside a function `FName`+"()" returning the grammar object NOTE: this function violates information hiding principles; in particular it "knows" the guts of the FSM and LexD classes |
Home | Trees | Index | Help |
|
---|
Generated by Epydoc 2.0 on Mon Nov 10 15:08:04 2003 | http://epydoc.sf.net |