Original Post
I want to write a binary expression parser in python - one that will take statements like:
(a AND b) OR (c AND (d OR NOT e))
and evaluate it for given set of variables a, b, c, d, and e. Now, this seems to be a pretty standard parsing problem that I could throw bison or maybe antlr at. But that seems overkill, and I'm not familiar with those tools anyway. Alternatively, I could write one from scratch in a (probably) naive manner. But I kind of don't want to. It would be a good learning experience, since I've only done the theory of formal languages and grammars in my classes and no real coding, but I don't got the time. So - is there a really quick way to parse these? I'm using python so it seems like there might even be a package for this kind of thing. Thanks :)