A context-free grammar production. Each production expands a single
Nonterminal (the left-hand side) to a sequence of terminals and
Nonterminals (the right-hand side). terminals can be any immutable hashable object that
is not a Nonterminal. Typically, terminals are strings
representing word types, such as "dog" or
"under".
Abstractly, a Grammar production indicates that the right-hand side is
a possible
| Method Summary |
| |
__init__(self,
lhs,
rhs)
Construct a new Production. |
| |
__cmp__(self,
other)
|
boolean
|
__eq__(self,
other)
Return true if this Production is equal to
other. |
int
|
__hash__(self)
Return a hash value for the Production. |
| |
__ne__(self,
other)
|
string
|
__repr__(self)
Return a concise string representation of the Production. |
string
|
__str__(self)
Return a verbose string representation of the Production. |
Nonterminal
|
lhs(self)
Return the left-hand side of this Production. |
sequence of (Nonterminal and (terminal))
|
rhs(self)
Return the right-hand side of this Production. |
Inherited from object:
__delattr__,
__getattribute__,
__new__,
__reduce__,
__reduce_ex__,
__setattr__
|