public void Execute(Lexem lexem) { Program.Add(lexem); }
public RuleMatch(Lexem lexem, GrammarRule rule) { Lexem = lexem; Rule = rule; }
public GrammarException(string message, Lexem lexem) : base(message) { Lexem = lexem; }
public RuleMatch Match(Lexem lexem) { var rule = Grammar.Find(r => r.IsMatch(lexem)) ?? throw new GrammarException("No rule for lexem " + lexem, lexem); return(new RuleMatch(lexem, rule)); }