6.9.1.4.4. Augment grammar

6.9.1.4.4. Augment grammar

This function adds a production S' -> S to the grammar where S was the start symbol.
Start python section to interscript/parsers/lalr1.py[8]
   157: #line 292 "lalr1_parser.ipk"
   158:   def augment(self):
   159:     lhss = map(lambda x: x.LHS, self.productions)
   160:     newsym = self.start
   161:     while newsym in lhss: newsym = newsym + "'"
   162:     self.productions.insert(0, Production(newsym, [self.start]))
   163: 
   164:   def unaugment(self):
   165:     del self.productions[0]
   166: 
End python section to interscript/parsers/lalr1.py[8]