public XamlMarkupExtensionGrammar() { // Non Terminals var markupExtension = new NonTerminal(MarkupExtensionTerm); var arguments = new NonTerminal("Arguments"); var namedArgs = new NonTerminal("NamedArgs"); var namedArg = new NonTerminal(NamedArgumentTerm); var positionalArgs = new NonTerminal("PositionalArgs"); var argument = new NonTerminal("Argument"); // Terminals var typeName = new TypeNameTerminal(TypeNameTerm); var memberName = new MemberNameTerminal(MemberNameTerm); var @string = new StringTerminal(StringTerm); var startExtension = ToTransientTerm("{"); var endExtension = ToTransientTerm("}"); var namedArgumentSeparator = ToTransientTerm("="); var argumentSeparator = ToTransientTerm(","); // Setup rules markupExtension.Rule = startExtension + typeName + endExtension | startExtension + typeName + arguments + endExtension; arguments.Rule = namedArgs | positionalArgs | positionalArgs + argumentSeparator + namedArgs; namedArgs.Rule = namedArg | namedArg + argumentSeparator + namedArgs; namedArg.Rule = memberName + namedArgumentSeparator + argument; positionalArgs.Rule = namedArgs | argument | argument + argumentSeparator + positionalArgs; argument.Rule = markupExtension | @string; this.Root = markupExtension; base.MarkTransient(arguments, argument); }