public static Parser Create() { // Create the object tree without DI Framework var expressionParser = new ExpressionParser(); var factorParser = new FactorParser(expressionParser); var termParser = new TermParser(factorParser); expressionParser.TermParser = termParser; var lexerRules = new LexerRules(); ILinePositionCalculator NewLinePositionCalculator(List <Lexem> lexems) => new LinePositionCalculator(lexems); ILexerReader NewLexerReader(string expression) => new LexerReader(expression); var tokenizer = new Tokenizer(lexerRules, NewLexerReader, NewLinePositionCalculator); IToken NewEpsilonToken() => new EpsilonToken(); var tokenWalker = new TokenWalker(tokenizer, NewEpsilonToken, NewLinePositionCalculator); return(new Parser(tokenWalker, expressionParser)); }
public TermParser(FactorParser factorParser) { _factorParser = factorParser; }