Programming a Truth Table

I am trying to create a program that prompts the user to input 2 Equations, do a truth table, then compare them. Most of it is within my ability, but what I am struggling with is the parsing of the inputted equations. For example:

F1 = !A * !B + A * B + !A * B F2 = !A + B

For something like this, I just made a char pointer that scans through the string looking for multiplication, doing that first, then the addition. My problem is parsing and getting the order of operations down for something like this:

F1 = !A * B (!C * !A * C) + B (A + !A * C)

F2 = !((A + !B*!C + C) * ( B * C + !A + A * !B * !C))

So how would you parse something with parenthensis. Not necessarily asking for help with code, more theory in breaking this down into proper operational order.

Thanks guys