code: def _add_rule(self, state, rule):
          
          if rule.strip() == "-":
              parsed_rule = None
          else:
              parsed_rule = rule.split(',')
  
              if  (len(parsed_rule) != 3 or
                   parsed_rule[1] not in ['L', 'N', 'R'] or
                   len(parsed_rule[2]) > 1):
                  raise SyntaxError('Wrong format of rule: ' + rule)
  
              if parsed_rule[0] == "":
                  parsed_rule[0] = self.alphabet[len(self.states[state])]
              if parsed_rule[2] == "":
                  parsed_rule[2] = state
  
          self.states[state].append(parsed_rule)
docs: Parse rule and add it to machine (for internal use).