public void Register(IGrammarBuilder <INode> grammar) { grammar.Sequence("minmax", grammar.TerminalValue("{"), grammar.Terminal(TokenType.Number).As("min"), grammar.Optional(null, grammar.TerminalValue(",")).As("sep"), grammar.Optional(null, grammar.Terminal(TokenType.Number)).As("max"), grammar.TerminalValue("}") ).ReduceWith(Reduce); }
public void Register(IGrammarBuilder <INode> grammar) { grammar.Choice("terminalLiteral", grammar.Terminal(TokenType.Literal), grammar.Sequence(null, grammar.TerminalValue("T"), grammar.TerminalValue("<"), grammar.Terminal(TokenType.Literal).Lift(), grammar.TerminalValue(">") ) ).ReduceWith(Reduce); }
public void Register(IGrammarBuilder <INode> grammar) { grammar.Sequence("definition", grammar.Terminal(TokenType.Identifier).As("name"), grammar.TerminalValue(":="), grammar.Ref("choice").As("rule") ).ReduceWith(Reduce); }
public void Register(IGrammarBuilder <INode> grammar) { grammar.Sequence("terminalType", grammar.TerminalValue("T"), grammar.TerminalValue("<"), grammar.Terminal(TokenType.Identifier).As("type"), grammar.TerminalValue(">") ).ReduceWith(Reduce); }
public void Register(IGrammarBuilder <INode> grammar) { grammar.Sequence("namedAtom", grammar.Ref("atomExpression").As("atom"), grammar.Optional(null, grammar.Choice(null, grammar.TerminalValue("#!"), grammar.Sequence(null, grammar.TerminalValue("#"), grammar.Terminal(TokenType.Identifier) )) ).As("name") ).ReduceWith(Reduce); }
public void Register(IGrammarBuilder <INode> grammar) { grammar.Terminal(TokenType.Identifier, "ruleRef") .ReduceWith(Reduce); }