title: Boolean expression (grammar) parser in c++
body: <p>I want to parse a boolean expression (in C++). Input form:</p>
  
  <pre><code>a and b xor (c and d or a and b);
  </code></pre>
  
  <p>I just want to parse this expression into a tree, knowing the precedence rule (not,and,xor,or).
  So the above expression should look something like:</p>
  
  <pre><code>(a and b) xor ((c and d) or (a and b));
  </code></pre>
  
  <p>to the parser.</p>
  
  <p>And the tree would be of form:</p>
  
  <pre><code>                        a
                     and
                          b
                 or
                          c
                     and
                          d
          xor
                     a
                and
                     b
  </code></pre>
  
  <p>The input will be either through command line or in the form of a string.
  I just need the parser.</p>
  
  <p>Are there any sources that can help me do this?</p>