python - How can I edit my parser to properly group "AND" and "OR" predicates? -
i trying write small parser able parse simple key = value queries. should smart enough handle and , or groups, and having higher precendence. example text-input: a = 10 && b = 20 = 10 || b = 20 = 10 && b = 20 || c = 30 the first 2 trivial. last should group first 2 predicates "and" group, , group should grouped in "or" group. i have basics down, got stuck on proper grouping. using ply uses flex/bison/lex/yacc syntax define grammar. if i'm totally heading down wrong track existing syntax please let me know... valuable learning experience concerning parsers. i've tried setting precedence, don't think it's caused reduce/reduce conflict. think it's more of issue of way i've defined grammar in general, can't figure out need change. below current implementation , unit-test file. test-file should understanding expected output. there's 1 failing test. that's 1 causes me headaches. the tests can run u