Original Post
I''m looking for a library or source that can parse a boolean equation (with variables). I have tried myself for several hours, but it''s taking too much time. I''m very certain that I can make a functioning parser, but it will take time and probably be very buggy. Do anyone know where I can find example source or a ([L]GPL) library for such parser? I have spent time searching, but it was very difficult to find anything.
It will need to be able to parse an equation like this:
"A(BC''+D)+A''(E''C)+G''"
Into preferable a binary tree, which I then can use to evaluate it.
As an alternative, I''d be happy to get some ideas how to make the parser. How the parsed equation is stored is already solved; it''s the parsing of the ASCII version that troubles me. I thought I had it solved, but then realized that it didn''t take operator precedance into account, which broke the whole concept I had.
Any pointers or tips are appreciated.