There is no restriction on what kind of sequence is used, nor on what kind of objects the grammar symbols are, except that the string "<EPS>" may not be the LHS symbol of a production, and "<EOF>" and None may not be used at all.
It is recommended that interned strings or integers be used as grammar symbols. Strings make debugging easy because they can be read. Integers are commonly produced by other generating software.
Note that a production may have other attributes. In particular, the attribute 'func' may be used by parsers as a function to be invoked when deriving a nonterminal, thus implementing syntax directed parsing for S-attributed grammars.
Note: There may be a prohibition against using -1 as a grammar symbol. This should be fixed, it should be permitted.
11: #line 67 "lalr1_parser.ipk" 12: class Production: 13: def __init__(self, LHS, RHS, **kwds): 14: self.LHS = LHS 15: self.RHS = RHS 16: for k in kwds.keys(): 17: setattr(self,k,kwds[k]) 18: 19: def __len__(self): 20: return len(self.RHS) 21: 22: def __repr__(self): 23: d = self.__dict__.copy() 24: del d['LHS'] 25: del d['RHS'] 26: return `self.LHS` + " -> " + `self.RHS`+' '+`d` 27: