Home | Trees | Indices | Help |
---|
|
Class for Context free grammars
Grammar rules stored in self.productions Start Cat stored in self.start_cat Provided: a method for computing the terminals of the grammar. Unchecked assumption: terminals never use upper case (built into parser)
|
|||
|
__init__(self,
start_cat,
trace=False)self.productions : a dictionary whose keys are
categories and whose values are lists of productions
|
||
|
__str__(self) If g1 is a grammar object run 'print g1' to trigger this code, which builds the string representation of the grammar that is printed |
||
| add_production(self, cat, production) | ||
|
compute_terminals(self) Place a set of grammar terminals in self.terminals |
|
self.productions : a dictionary whose keys are categories
and whose values are lists of productions
|
|
|
Place a set of grammar terminals in self.terminals Assumption: No symbol that ever occurs in the LHS of a production ever needs to occur in an input string. Counterexample: If 's' is the start symbol of the grammar it is also the possession-marking 'word' in English. |
Home | Trees | Indices | Help |
---|
Generated by Epydoc 3.0alpha3 on Sat May 5 22:37:39 2007 | http://epydoc.sourceforge.net |