c++11 - Resolve circular dependency of std::functions in C++ -
i'm trying implement parser combinators educational purposes. parser defined std::function<t(input&)>
. have come point able define simple expression grammar, using code:
auto expression; // type not matter context auto factor = number | (token('(') >= expression >= token(')')) ; auto term = factor >= *( (token('*') | token('/')) >= factor ); expression = term >= *( (token('+') | token('-')) >= term );
as can seen, problem circular dependencies. can not figure out way resolve circular dependency grouped factor causes. operators constructing factor parser need expression parser constructed @ end. how resolve this?
Comments
Post a Comment