Supported rules: `a -> b` and `a => b` (terminal rule).

def add_rule(self, rule):
        """Supported rules: `a -> b` and `a => b` (terminal rule)."""
        parsed_rule = None

        if rule.count('->') == 1 and rule.count('=>') == 0:
            parsed_rule = tuple(''.join(part.split()) for part in rule.split('->')) + (0,)
        elif rule.count('->') == 0 and rule.count('=>') == 1:
            parsed_rule = tuple(''.join(part.split()) for part in rule.split('=>')) + (1,)

        if parsed_rule is None:
            raise SyntaxError('Wrong format: ' + rule)
        else:
            self.rules.append(parsed_rule)