I want Lark grammar strings passed to Lark(...) to support a %extend directive for adding alternatives to an existing rule or terminal without redefining it from scratch. For example, if an imported grammar defines expr: A B, then a grammar using %import .grammars.ab (startab, A, B, expr) followed by %extend expr: B A should build successfully, and Lark(..., start='startab', source_path=__file__).parse('abab') should accept the extra B A alternative inside expr. If a grammar defines x: "a" and then has both %extend x: "b" and %extend x: "c", the resulting parser should accept strings containing any of a, b, or c in that rule position. %extend should work for terminals too: extending A with %extend A: "c" should make the terminal match the added literal wherever A is used. Invalid uses should raise GrammarError: extending a symbol that has not been defined, extending a rule as a terminal or a terminal as a rule, extending a template with a different parameter list, or extending a %declared abstract symbol should all fail during Lark(...) construction.