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

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -